aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/Local.cpp
diff options
context:
space:
mode:
authorLeo Li <aoli@google.com>2017-07-10 20:45:34 +0000
committerLeo Li <aoli@google.com>2017-07-10 20:45:34 +0000
commit93abd7d915fb12c9967fe2433dfc873d3b4e938d (patch)
treec37b55fac997a6034a8646df03ff81e3e8fbcb41 /llvm/lib/Transforms/Utils/Local.cpp
parenta7a77540ef747aa5674014c696a289d45a168641 (diff)
downloadllvm-93abd7d915fb12c9967fe2433dfc873d3b4e938d.zip
llvm-93abd7d915fb12c9967fe2433dfc873d3b4e938d.tar.gz
llvm-93abd7d915fb12c9967fe2433dfc873d3b4e938d.tar.bz2
[ConstantHoisting] Remove dupliate logic in constant hoisting
Summary: As metioned in https://reviews.llvm.org/D34576, checkings in `collectConstantCandidates` can be replaced by using `llvm::canReplaceOperandWithVariable`. The only special case is that `collectConstantCandidates` return false for all `IntrinsicInst` but it is safe for us to collect constant candidates from `IntrinsicInst`. Reviewers: pirama, efriedma, srhines Reviewed By: efriedma Subscribers: llvm-commits, javed.absar Differential Revision: https://reviews.llvm.org/D34921 llvm-svn: 307587
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/Local.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index bc13585..7461061 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -2169,6 +2169,9 @@ bool llvm::canReplaceOperandWithVariable(const Instruction *I, unsigned OpIdx) {
return true;
case Instruction::Call:
case Instruction::Invoke:
+ // Can't handle inline asm. Skip it.
+ if (isa<InlineAsm>(ImmutableCallSite(I).getCalledValue()))
+ return false;
// Many arithmetic intrinsics have no issue taking a
// variable, however it's hard to distingish these from
// specials such as @llvm.frameaddress that require a constant.