diff options
author | David Majnemer <david.majnemer@gmail.com> | 2016-08-03 17:12:47 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2016-08-03 17:12:47 +0000 |
commit | fad04908692228a1853e93e9adbbd398756629ff (patch) | |
tree | 7991ea2a27bb24855e5e54d6a97d6a751c03f5c3 /llvm/lib/Analysis/InstructionSimplify.cpp | |
parent | 57dc4cf0e1dc149f05569aee7c5dd8fec04f81b4 (diff) | |
download | llvm-fad04908692228a1853e93e9adbbd398756629ff.zip llvm-fad04908692228a1853e93e9adbbd398756629ff.tar.gz llvm-fad04908692228a1853e93e9adbbd398756629ff.tar.bz2 |
[CloneFunction] Don't remove side effecting calls
We were able to figure out that the result of a call is some constant.
While propagating that fact, we added the constant to the value map.
This is problematic because it results in us losing the call site when
processing the value map.
This fixes PR28802.
llvm-svn: 277611
Diffstat (limited to 'llvm/lib/Analysis/InstructionSimplify.cpp')
-rw-r--r-- | llvm/lib/Analysis/InstructionSimplify.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp index 5b723e5..ac03fdc 100644 --- a/llvm/lib/Analysis/InstructionSimplify.cpp +++ b/llvm/lib/Analysis/InstructionSimplify.cpp @@ -4356,7 +4356,8 @@ static bool replaceAndRecursivelySimplifyImpl(Instruction *I, Value *SimpleV, // Gracefully handle edge cases where the instruction is not wired into any // parent block. - if (I->getParent()) + if (I->getParent() && !I->isEHPad() && !isa<TerminatorInst>(I) && + !I->mayHaveSideEffects()) I->eraseFromParent(); } else { Worklist.insert(I); @@ -4384,7 +4385,8 @@ static bool replaceAndRecursivelySimplifyImpl(Instruction *I, Value *SimpleV, // Gracefully handle edge cases where the instruction is not wired into any // parent block. - if (I->getParent()) + if (I->getParent() && !I->isEHPad() && !isa<TerminatorInst>(I) && + !I->mayHaveSideEffects()) I->eraseFromParent(); } return Simplified; |