aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/InstructionSimplify.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2016-08-03 17:12:47 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2016-08-03 17:12:47 +0000
commitfad04908692228a1853e93e9adbbd398756629ff (patch)
tree7991ea2a27bb24855e5e54d6a97d6a751c03f5c3 /llvm/lib/Analysis/InstructionSimplify.cpp
parent57dc4cf0e1dc149f05569aee7c5dd8fec04f81b4 (diff)
downloadllvm-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.cpp6
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;