[llvm-commits] CVS: llvm/lib/Transforms/ExprTypeConvert.cpp LevelRaise.cpp

Reid Spencer reid at x10sys.com
Fri Dec 22 22:07:00 PST 2006



Changes in directory llvm/lib/Transforms:

ExprTypeConvert.cpp updated: 1.117 -> 1.118
LevelRaise.cpp updated: 1.116 -> 1.117
---
Log message:

For PR950: http://llvm.org/PR950 :
This patch removes the SetCC instructions and replaces them with the ICmp
and FCmp instructions. The SetCondInst instruction has been removed and 
been replaced with ICmpInst and FCmpInst.


---
Diffs of the changes:  (+21 -10)

 ExprTypeConvert.cpp |   28 +++++++++++++++++++++-------
 LevelRaise.cpp      |    3 ---
 2 files changed, 21 insertions(+), 10 deletions(-)


Index: llvm/lib/Transforms/ExprTypeConvert.cpp
diff -u llvm/lib/Transforms/ExprTypeConvert.cpp:1.117 llvm/lib/Transforms/ExprTypeConvert.cpp:1.118
--- llvm/lib/Transforms/ExprTypeConvert.cpp:1.117	Mon Dec 18 02:47:13 2006
+++ llvm/lib/Transforms/ExprTypeConvert.cpp	Sat Dec 23 00:05:41 2006
@@ -463,10 +463,13 @@
     return ValueConvertibleToType(I, Ty, CTMap, TD) &&
            ExpressionConvertibleToType(OtherOp, Ty, CTMap, TD);
   }
-  case Instruction::SetEQ:
-  case Instruction::SetNE: {
-    Value *OtherOp = I->getOperand((V == I->getOperand(0)) ? 1 : 0);
-    return ExpressionConvertibleToType(OtherOp, Ty, CTMap, TD);
+  case Instruction::ICmp: {
+    if (cast<ICmpInst>(I)->getPredicate() == ICmpInst::ICMP_EQ ||
+        cast<ICmpInst>(I)->getPredicate() == ICmpInst::ICMP_NE) {
+      Value *OtherOp = I->getOperand((V == I->getOperand(0)) ? 1 : 0);
+      return ExpressionConvertibleToType(OtherOp, Ty, CTMap, TD);
+    }
+    return false;
   }
   case Instruction::LShr:
   case Instruction::AShr:
@@ -717,9 +720,7 @@
   }
 
   case Instruction::Add:
-  case Instruction::Sub:
-  case Instruction::SetEQ:
-  case Instruction::SetNE: {
+  case Instruction::Sub: {
     Res = BinaryOperator::create(cast<BinaryOperator>(I)->getOpcode(),
                                  Dummy, Dummy, Name);
     VMC.ExprMap[I] = Res;   // Add node to expression eagerly
@@ -731,6 +732,19 @@
     Res->setOperand(OtherIdx, NewOther);
     break;
   }
+  case Instruction::ICmp: {
+    ICmpInst::Predicate pred = cast<ICmpInst>(I)->getPredicate();
+    if (pred == ICmpInst::ICMP_EQ || pred == ICmpInst::ICMP_NE) {
+      Res = new ICmpInst(pred, Dummy, Dummy, Name);
+      VMC.ExprMap[I] = Res;  // Add node to expression eagerly
+      unsigned OtherIdx = (OldVal == I->getOperand(0)) ? 1 : 0;
+      Value *OtherOp    = I->getOperand(OtherIdx);
+      Res->setOperand(!OtherIdx, NewVal);
+      Value *NewOther   = ConvertExpressionToType(OtherOp, NewTy, VMC, TD);
+      Res->setOperand(OtherIdx, NewOther);
+    }
+    break;
+  }
   case Instruction::Shl:
   case Instruction::LShr:
   case Instruction::AShr:


Index: llvm/lib/Transforms/LevelRaise.cpp
diff -u llvm/lib/Transforms/LevelRaise.cpp:1.116 llvm/lib/Transforms/LevelRaise.cpp:1.117
--- llvm/lib/Transforms/LevelRaise.cpp:1.116	Tue Dec 19 16:17:40 2006
+++ llvm/lib/Transforms/LevelRaise.cpp	Sat Dec 23 00:05:41 2006
@@ -393,9 +393,6 @@
   return false;
 }
 
-
-
-
 bool RPR::DoRaisePass(Function &F) {
   bool Changed = false;
   for (Function::iterator BB = F.begin(), BBE = F.end(); BB != BBE; ++BB)






More information about the llvm-commits mailing list