summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDavide Italiano <davide@freebsd.org>2017-04-29 00:12:18 +0000
committerDavide Italiano <davide@freebsd.org>2017-04-29 00:12:18 +0000
commit534e314356e597a0dcfcda937fae7538c61b90ca (patch)
tree905e9687c456d67b4181c4f15808cca3042bbeb2 /llvm/lib
parent19ae6dc853d3d4f867a6d1308f3c3fcca754a7a2 (diff)
downloadbcm5719-llvm-534e314356e597a0dcfcda937fae7538c61b90ca.tar.gz
bcm5719-llvm-534e314356e597a0dcfcda937fae7538c61b90ca.zip
[LoopUnswitch] Don't remove instructions with side effects.
This fixes PR32818. Differential Revision: https://reviews.llvm.org/D32664 llvm-svn: 301722
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopUnswitch.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
index 0b56b4e7ab1..2cda954a096 100644
--- a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
@@ -1275,7 +1275,8 @@ static void ReplaceUsesOfWith(Instruction *I, Value *V,
LPM->deleteSimpleAnalysisValue(I, L);
RemoveFromWorklist(I, Worklist);
I->replaceAllUsesWith(V);
- I->eraseFromParent();
+ if (!I->mayHaveSideEffects())
+ I->eraseFromParent();
++NumSimplify;
}
OpenPOWER on IntegriCloud