This code can handle non-dominating instructions
authorChris Lattner <sabre@nondot.org>
Fri, 5 Aug 2005 00:57:45 +0000 (00:57 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 5 Aug 2005 00:57:45 +0000 (00:57 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22667 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Utils/LoopSimplify.cpp
lib/Transforms/Utils/PromoteMemoryToRegister.cpp

index 5ddcc4163db067fae26134a9bad309f2a956764c..da1a6550a497bb68304711ae208cd52f07d5c3b1 100644 (file)
@@ -256,7 +256,7 @@ BasicBlock *LoopSimplify::SplitBlockPredecessors(BasicBlock *BB,
       PN->addIncoming(InVal, NewBB);
 
       // Can we eliminate this phi node now?
-      if (Value *V = PN->hasConstantValue()) {
+      if (Value *V = PN->hasConstantValue(true)) {
         if (!isa<Instruction>(V) ||
             getAnalysis<DominatorSet>().dominates(cast<Instruction>(V), PN)) {
           PN->replaceAllUsesWith(V);
index bb7f8680933b5f87d0d90484a5cc025d00208e66..d6e6b6cbb1aab1bc1bd246d0de67147871563479 100644 (file)
@@ -347,7 +347,7 @@ void PromoteMem2Reg::run() {
     PHINode *SomePHI = 0;
     for (unsigned i = 0, e = PNs.size(); i != e; ++i)
       if (PNs[i]) {
-        if (Value *V = PNs[i]->hasConstantValue()) {
+        if (Value *V = PNs[i]->hasConstantValue(true)) {
           if (!isa<Instruction>(V) || dominates(cast<Instruction>(V), PNs[i])) {
             if (AST && isa<PointerType>(PNs[i]->getType()))
               AST->deleteValue(PNs[i]);