summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
-rw-r--r--llvm/lib/Transforms/Scalar/ADCE.cpp2
-rw-r--r--llvm/lib/Transforms/Scalar/GVN.cpp6
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp2
-rw-r--r--llvm/lib/Transforms/Scalar/LoopDeletion.cpp5
-rw-r--r--llvm/lib/Transforms/Scalar/LoopIndexSplit.cpp2
-rw-r--r--llvm/lib/Transforms/Scalar/LoopUnswitch.cpp4
-rw-r--r--llvm/lib/Transforms/Scalar/TailDuplication.cpp2
-rw-r--r--llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp2
8 files changed, 11 insertions, 14 deletions
diff --git a/llvm/lib/Transforms/Scalar/ADCE.cpp b/llvm/lib/Transforms/Scalar/ADCE.cpp
index bfea2b27841..9c55f664ebb 100644
--- a/llvm/lib/Transforms/Scalar/ADCE.cpp
+++ b/llvm/lib/Transforms/Scalar/ADCE.cpp
@@ -57,7 +57,7 @@ bool ADCE::runOnFunction(Function& F) {
for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I)
if (isa<TerminatorInst>(I.getInstructionIterator()) ||
isa<DbgInfoIntrinsic>(I.getInstructionIterator()) ||
- I->mayWriteToMemory()) {
+ I->mayHaveSideEffects()) {
alive.insert(I.getInstructionIterator());
worklist.push_back(I.getInstructionIterator());
}
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp
index d605ffb6602..260bbedddc9 100644
--- a/llvm/lib/Transforms/Scalar/GVN.cpp
+++ b/llvm/lib/Transforms/Scalar/GVN.cpp
@@ -1479,13 +1479,13 @@ bool GVN::performPRE(Function& F) {
for (BasicBlock::iterator BI = CurrentBlock->begin(),
BE = CurrentBlock->end(); BI != BE; ) {
Instruction *CurInst = BI++;
-
+
if (isa<AllocationInst>(CurInst) || isa<TerminatorInst>(CurInst) ||
isa<PHINode>(CurInst) || (CurInst->getType() == Type::VoidTy) ||
- CurInst->mayReadFromMemory() || CurInst->mayWriteToMemory() ||
+ CurInst->mayReadFromMemory() || CurInst->mayHaveSideEffects() ||
isa<DbgInfoIntrinsic>(CurInst))
continue;
-
+
uint32_t valno = VN.lookup(CurInst);
// Look for the predecessors for PRE opportunities. We're
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index eebac00a10c..9feb442df97 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -12579,7 +12579,7 @@ static bool TryToSinkInstruction(Instruction *I, BasicBlock *DestBlock) {
assert(I->hasOneUse() && "Invariants didn't hold!");
// Cannot move control-flow-involving, volatile loads, vaarg, etc.
- if (isa<PHINode>(I) || I->mayWriteToMemory() || isa<TerminatorInst>(I))
+ if (isa<PHINode>(I) || I->mayHaveSideEffects() || isa<TerminatorInst>(I))
return false;
// Do not sink alloca instructions out of the entry block.
diff --git a/llvm/lib/Transforms/Scalar/LoopDeletion.cpp b/llvm/lib/Transforms/Scalar/LoopDeletion.cpp
index 96b7a5288a7..65126728c7f 100644
--- a/llvm/lib/Transforms/Scalar/LoopDeletion.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopDeletion.cpp
@@ -136,11 +136,8 @@ bool LoopDeletion::IsLoopDead(Loop* L,
LI != LE; ++LI) {
for (BasicBlock::iterator BI = (*LI)->begin(), BE = (*LI)->end();
BI != BE; ++BI) {
- if (BI->mayWriteToMemory())
+ if (BI->mayHaveSideEffects())
return false;
- else if (LoadInst* L = dyn_cast<LoadInst>(BI))
- if (L->isVolatile())
- return false;
}
}
diff --git a/llvm/lib/Transforms/Scalar/LoopIndexSplit.cpp b/llvm/lib/Transforms/Scalar/LoopIndexSplit.cpp
index ffa1d902b77..40d2e4a9d8b 100644
--- a/llvm/lib/Transforms/Scalar/LoopIndexSplit.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopIndexSplit.cpp
@@ -1148,7 +1148,7 @@ bool LoopIndexSplit::cleanBlock(BasicBlock *BB) {
|| isa<DbgInfoIntrinsic>(I))
continue;
- if (I->mayWriteToMemory())
+ if (I->mayHaveSideEffects())
return false;
// I is used only inside this block then it is OK.
diff --git a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
index 2afb3c8ed7a..e3e881f0812 100644
--- a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
@@ -300,7 +300,7 @@ static bool isTrivialLoopExitBlockHelper(Loop *L, BasicBlock *BB,
// Okay, everything after this looks good, check to make sure that this block
// doesn't include any side effects.
for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I)
- if (I->mayWriteToMemory())
+ if (I->mayHaveSideEffects())
return false;
return true;
@@ -383,7 +383,7 @@ bool LoopUnswitch::IsTrivialUnswitchCondition(Value *Cond, Constant **Val,
// part of the loop that the code *would* execute. We already checked the
// tail, check the header now.
for (BasicBlock::iterator I = Header->begin(), E = Header->end(); I != E; ++I)
- if (I->mayWriteToMemory())
+ if (I->mayHaveSideEffects())
return false;
return true;
}
diff --git a/llvm/lib/Transforms/Scalar/TailDuplication.cpp b/llvm/lib/Transforms/Scalar/TailDuplication.cpp
index 78690699bd5..99a7dee3988 100644
--- a/llvm/lib/Transforms/Scalar/TailDuplication.cpp
+++ b/llvm/lib/Transforms/Scalar/TailDuplication.cpp
@@ -258,7 +258,7 @@ void TailDup::eliminateUnconditionalBranch(BranchInst *Branch) {
while (!isa<TerminatorInst>(BBI)) {
Instruction *I = BBI++;
- bool CanHoist = !I->isTrapping() && !I->mayWriteToMemory();
+ bool CanHoist = !I->isTrapping() && !I->mayHaveSideEffects();
if (CanHoist) {
for (unsigned op = 0, e = I->getNumOperands(); op != e; ++op)
if (Instruction *OpI = dyn_cast<Instruction>(I->getOperand(op)))
diff --git a/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp b/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp
index e1234efb578..682d069923e 100644
--- a/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp
@@ -201,7 +201,7 @@ bool TailCallElim::runOnFunction(Function &F) {
bool TailCallElim::CanMoveAboveCall(Instruction *I, CallInst *CI) {
// FIXME: We can move load/store/call/free instructions above the call if the
// call does not mod/ref the memory location being processed.
- if (I->mayWriteToMemory() || isa<LoadInst>(I))
+ if (I->mayHaveSideEffects() || isa<LoadInst>(I))
return false;
// Otherwise, if this is a side-effect free instruction, check to make sure
OpenPOWER on IntegriCloud