summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2016-06-24 22:52:39 +0000
committerNico Weber <nicolasweber@gmx.de>2016-06-24 22:52:39 +0000
commitae2ef4ccd4b904461009c4444e1ae9006a666c0e (patch)
tree5e15cef9fa969476d81a31a2f81bd5f1c3371177 /llvm/lib/Transforms/Utils/SimplifyCFG.cpp
parentbabc13a3e25636bd6b9ee64baf42bca1a8e497cf (diff)
downloadbcm5719-llvm-ae2ef4ccd4b904461009c4444e1ae9006a666c0e.tar.gz
bcm5719-llvm-ae2ef4ccd4b904461009c4444e1ae9006a666c0e.zip
Revert r273711, it caused PR28298.
llvm-svn: 273743
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyCFG.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index d22f5c63dee..6e1ac2c9a69 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -1885,19 +1885,14 @@ static bool FoldCondBranchOnPHI(BranchInst *BI, const DataLayout &DL) {
// Check for trivial simplification.
if (Value *V = SimplifyInstruction(N, DL)) {
- if (!BBI->use_empty())
- TranslateMap[&*BBI] = V;
- if (!N->mayHaveSideEffects()) {
- delete N; // Instruction folded away, don't need actual inst
- N = nullptr;
- }
+ TranslateMap[&*BBI] = V;
+ delete N; // Instruction folded away, don't need actual inst
} else {
+ // Insert the new instruction into its new home.
+ EdgeBB->getInstList().insert(InsertPt, N);
if (!BBI->use_empty())
TranslateMap[&*BBI] = N;
}
- // Insert the new instruction into its new home.
- if (N)
- EdgeBB->getInstList().insert(InsertPt, N);
}
// Loop over all of the edges from PredBB to BB, changing them to branch
OpenPOWER on IntegriCloud