aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/Scalar/ADCE.cpp2
-rw-r--r--lib/Transforms/Scalar/Reassociate.cpp2
-rw-r--r--lib/Transforms/Utils/Local.cpp2
3 files changed, 3 insertions, 3 deletions
diff --git a/lib/Transforms/Scalar/ADCE.cpp b/lib/Transforms/Scalar/ADCE.cpp
index 24ccee6034..e7bc1357ff 100644
--- a/lib/Transforms/Scalar/ADCE.cpp
+++ b/lib/Transforms/Scalar/ADCE.cpp
@@ -154,7 +154,7 @@ bool ADCE::doADCE() {
BBI != BBE; ++BBI) {
BasicBlock *BB = *BBI;
for (BasicBlock::iterator II = BB->begin(), EI = BB->end(); II != EI; ) {
- if (II->hasSideEffects() || II->getOpcode() == Instruction::Ret) {
+ if (II->mayWriteToMemory() || II->getOpcode() == Instruction::Ret) {
markInstructionLive(II);
++II; // Increment the inst iterator if the inst wasn't deleted
} else if (isInstructionTriviallyDead(II)) {
diff --git a/lib/Transforms/Scalar/Reassociate.cpp b/lib/Transforms/Scalar/Reassociate.cpp
index 4212e6ae69..df0a64188f 100644
--- a/lib/Transforms/Scalar/Reassociate.cpp
+++ b/lib/Transforms/Scalar/Reassociate.cpp
@@ -74,7 +74,7 @@ unsigned Reassociate::getRank(Value *V) {
if (I->getOpcode() == Instruction::PHINode ||
I->getOpcode() == Instruction::Alloca ||
I->getOpcode() == Instruction::Malloc || isa<TerminatorInst>(I) ||
- I->hasSideEffects())
+ I->mayWriteToMemory()) // Cannot move inst if it writes to memory!
return RankMap[I->getParent()];
unsigned &CachedRank = InstRankMap[I];
diff --git a/lib/Transforms/Utils/Local.cpp b/lib/Transforms/Utils/Local.cpp
index 10028bacec..8f67e111a7 100644
--- a/lib/Transforms/Utils/Local.cpp
+++ b/lib/Transforms/Utils/Local.cpp
@@ -91,7 +91,7 @@ bool ConstantFoldTerminator(BasicBlock *BB) {
//
bool isInstructionTriviallyDead(Instruction *I) {
- return I->use_empty() && !I->hasSideEffects() && !isa<TerminatorInst>(I);
+ return I->use_empty() && !I->mayWriteToMemory() && !isa<TerminatorInst>(I);
}
// dceInstruction - Inspect the instruction at *BBI and figure out if it's