diff options
author | Hiroshi Yamauchi <yamauchi@google.com> | 2020-02-27 13:59:59 -0800 |
---|---|---|
committer | Hiroshi Yamauchi <yamauchi@google.com> | 2020-02-28 09:35:09 -0800 |
commit | 41e06ae7ba911661962c9f190ae88d1f29c076da (patch) | |
tree | 603ddfcdb7f8af65fc42a820df7be9a9f869f764 /llvm/lib/Transforms/Utils/CallPromotionUtils.cpp | |
parent | 02e5e47e170c132f8c109ae994cdd5f6029e4b36 (diff) | |
download | llvm-41e06ae7ba911661962c9f190ae88d1f29c076da.zip llvm-41e06ae7ba911661962c9f190ae88d1f29c076da.tar.gz llvm-41e06ae7ba911661962c9f190ae88d1f29c076da.tar.bz2 |
[CallPromotionUtils] Add missing promotion legality check to tryPromoteCall.
Summary: This fixes the crash that led to the revert of D69591.
Reviewers: davidxl
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D75307
Diffstat (limited to 'llvm/lib/Transforms/Utils/CallPromotionUtils.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/CallPromotionUtils.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/CallPromotionUtils.cpp b/llvm/lib/Transforms/Utils/CallPromotionUtils.cpp index 09cd537..19e7efe 100644 --- a/llvm/lib/Transforms/Utils/CallPromotionUtils.cpp +++ b/llvm/lib/Transforms/Utils/CallPromotionUtils.cpp @@ -511,6 +511,9 @@ bool llvm::tryPromoteCall(CallSite &CS) { if (!DirectCallee) return false; // No function pointer found. + if (!isLegalToPromote(CS, DirectCallee)) + return false; + // Success. promoteCall(CS, DirectCallee); return true; |