[llvm-commits] CVS: llvm/lib/Transforms/Scalar/CondPropagate.cpp CorrelatedExprs.cpp InstructionCombining.cpp LoopUnswitch.cpp PredicateSimplifier.cpp SCCP.cpp

Reid Spencer reid at x10sys.com
Thu Jan 11 10:22:22 PST 2007



Changes in directory llvm/lib/Transforms/Scalar:

CondPropagate.cpp updated: 1.12 -> 1.13
CorrelatedExprs.cpp updated: 1.45 -> 1.46
InstructionCombining.cpp updated: 1.590 -> 1.591
LoopUnswitch.cpp updated: 1.54 -> 1.55
PredicateSimplifier.cpp updated: 1.43 -> 1.44
SCCP.cpp updated: 1.148 -> 1.149
---
Log message:

Rename BoolTy as Int1Ty. Patch by Sheng Zhou.


---
Diffs of the changes:  (+29 -29)

 CondPropagate.cpp        |    2 +-
 CorrelatedExprs.cpp      |    2 +-
 InstructionCombining.cpp |   30 +++++++++++++++---------------
 LoopUnswitch.cpp         |   12 ++++++------
 PredicateSimplifier.cpp  |    6 +++---
 SCCP.cpp                 |    6 +++---
 6 files changed, 29 insertions(+), 29 deletions(-)


Index: llvm/lib/Transforms/Scalar/CondPropagate.cpp
diff -u llvm/lib/Transforms/Scalar/CondPropagate.cpp:1.12 llvm/lib/Transforms/Scalar/CondPropagate.cpp:1.13
--- llvm/lib/Transforms/Scalar/CondPropagate.cpp:1.12	Thu Jan 11 06:24:14 2007
+++ llvm/lib/Transforms/Scalar/CondPropagate.cpp	Thu Jan 11 12:21:29 2007
@@ -134,7 +134,7 @@
   // possible, and to avoid invalidating "i".
   for (unsigned i = PN->getNumIncomingValues(); i != 0; --i)
     if (ConstantInt *CB = dyn_cast<ConstantInt>(PN->getIncomingValue(i-1))) {
-      if (CB->getType() != Type::BoolTy) continue;
+      if (CB->getType() != Type::Int1Ty) continue;
       // If we have a constant, forward the edge from its current to its
       // ultimate destination.
       bool PHIGone = PN->getNumIncomingValues() == 2;


Index: llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp
diff -u llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.45 llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.46
--- llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.45	Thu Jan 11 06:24:14 2007
+++ llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp	Thu Jan 11 12:21:29 2007
@@ -833,7 +833,7 @@
   // it's a constant, then see if the other one is one of a setcc instruction,
   // an AND, OR, or XOR instruction.
   //
-  if (Op1->getType() == Type::BoolTy)
+  if (Op1->getType() == Type::Int1Ty)
     if (ConstantInt *CB = dyn_cast<ConstantInt>(Op1)) {
   
       if (Instruction *Inst = dyn_cast<Instruction>(Op0)) {


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.590 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.591
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.590	Thu Jan 11 08:38:17 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Thu Jan 11 12:21:29 2007
@@ -1626,7 +1626,7 @@
 
   if (isa<Constant>(TV) || isa<Constant>(FV)) {
     // Bool selects with constant operands can be folded to logical ops.
-    if (SI->getType() == Type::BoolTy) return 0;
+    if (SI->getType() == Type::Int1Ty) return 0;
 
     Value *SelectTrueVal = FoldOperationIntoSelectOperand(Op, TV, IC);
     Value *SelectFalseVal = FoldOperationIntoSelectOperand(Op, FV, IC);
@@ -2203,11 +2203,11 @@
   // formed.
   CastInst *BoolCast = 0;
   if (ZExtInst *CI = dyn_cast<ZExtInst>(I.getOperand(0)))
-    if (CI->getOperand(0)->getType() == Type::BoolTy)
+    if (CI->getOperand(0)->getType() == Type::Int1Ty)
       BoolCast = CI;
   if (!BoolCast)
     if (ZExtInst *CI = dyn_cast<ZExtInst>(I.getOperand(1)))
-      if (CI->getOperand(0)->getType() == Type::BoolTy)
+      if (CI->getOperand(0)->getType() == Type::Int1Ty)
         BoolCast = CI;
   if (BoolCast) {
     if (ICmpInst *SCI = dyn_cast<ICmpInst>(BoolCast->getOperand(0))) {
@@ -4284,7 +4284,7 @@
     return ReplaceInstUsesWith(I, ConstantInt::get(isTrueWhenEqual(I)));
 
   if (isa<UndefValue>(Op1))                  // fcmp pred X, undef -> undef
-    return ReplaceInstUsesWith(I, UndefValue::get(Type::BoolTy));
+    return ReplaceInstUsesWith(I, UndefValue::get(Type::Int1Ty));
 
   // Handle fcmp with constant RHS
   if (Constant *RHSC = dyn_cast<Constant>(Op1)) {
@@ -4336,7 +4336,7 @@
     return ReplaceInstUsesWith(I, ConstantInt::get(isTrueWhenEqual(I)));
 
   if (isa<UndefValue>(Op1))                  // X icmp undef -> undef
-    return ReplaceInstUsesWith(I, UndefValue::get(Type::BoolTy));
+    return ReplaceInstUsesWith(I, UndefValue::get(Type::Int1Ty));
 
   // icmp of GlobalValues can never equal each other as long as they aren't
   // external weak linkage type.
@@ -4354,7 +4354,7 @@
     return ReplaceInstUsesWith(I, ConstantInt::get(!isTrueWhenEqual(I)));
 
   // icmp's with boolean values can always be turned into bitwise operations
-  if (Ty == Type::BoolTy) {
+  if (Ty == Type::Int1Ty) {
     switch (I.getPredicate()) {
     default: assert(0 && "Invalid icmp instruction!");
     case ICmpInst::ICMP_EQ: {               // icmp eq bool %A, %B -> ~(A^B)
@@ -5282,7 +5282,7 @@
     //
     // However, it is OK if SrcTy is bool (See cast-set.ll testcase)
     // OR operation is EQ/NE.
-    if (isSignedExt == isSignedCmp || SrcTy == Type::BoolTy || ICI.isEquality())
+    if (isSignedExt == isSignedCmp || SrcTy == Type::Int1Ty || ICI.isEquality())
       return new ICmpInst(ICI.getPredicate(), LHSCIOp, Res1);
     else
       return 0;
@@ -6250,7 +6250,7 @@
         // Turn 'trunc (lshr X, Y) to bool' into '(X & (1 << Y)) != 0'.  This is
         // more LLVM instructions, but allows '1 << Y' to be hoisted if
         // loop-invariant and CSE'd.
-        if (CI.getType() == Type::BoolTy && SrcI->hasOneUse()) {
+        if (CI.getType() == Type::Int1Ty && SrcI->hasOneUse()) {
           Value *One = ConstantInt::get(SrcI->getType(), 1);
 
           Value *V = InsertNewInstBefore(new ShiftInst(Instruction::Shl, One,
@@ -6570,10 +6570,10 @@
       return ReplaceInstUsesWith(SI, FalseVal);
   }
 
-  if (SI.getType() == Type::BoolTy) {
+  if (SI.getType() == Type::Int1Ty) {
     ConstantInt *C;
     if ((C = dyn_cast<ConstantInt>(TrueVal)) && 
-        C->getType() == Type::BoolTy) {
+        C->getType() == Type::Int1Ty) {
       if (C->getBoolValue()) {
         // Change: A = select B, true, C --> A = or B, C
         return BinaryOperator::createOr(CondVal, FalseVal);
@@ -6585,7 +6585,7 @@
         return BinaryOperator::createAnd(NotCond, FalseVal);
       }
     } else if ((C = dyn_cast<ConstantInt>(FalseVal)) &&
-               C->getType() == Type::BoolTy) {
+               C->getType() == Type::Int1Ty) {
       if (C->getBoolValue() == false) {
         // Change: A = select B, C, false --> A = and B, C
         return BinaryOperator::createAnd(CondVal, TrueVal);
@@ -7132,7 +7132,7 @@
       // If the call and callee calling conventions don't match, this call must
       // be unreachable, as the call is undefined.
       new StoreInst(ConstantInt::getTrue(),
-                    UndefValue::get(PointerType::get(Type::BoolTy)), OldCall);
+                    UndefValue::get(PointerType::get(Type::Int1Ty)), OldCall);
       if (!OldCall->use_empty())
         OldCall->replaceAllUsesWith(UndefValue::get(OldCall->getType()));
       if (isa<CallInst>(OldCall))   // Not worth removing an invoke here.
@@ -7145,7 +7145,7 @@
     // undef so that we know that this code is not reachable, despite the fact
     // that we can't modify the CFG here.
     new StoreInst(ConstantInt::getTrue(),
-                  UndefValue::get(PointerType::get(Type::BoolTy)),
+                  UndefValue::get(PointerType::get(Type::Int1Ty)),
                   CS.getInstruction());
 
     if (!CS.getInstruction()->use_empty())
@@ -7937,7 +7937,7 @@
   if (isa<UndefValue>(Op)) {
     // Insert a new store to null because we cannot modify the CFG here.
     new StoreInst(ConstantInt::getTrue(),
-                  UndefValue::get(PointerType::get(Type::BoolTy)), &FI);
+                  UndefValue::get(PointerType::get(Type::Int1Ty)), &FI);
     return EraseInstFromFunction(FI);
   }
 
@@ -9048,7 +9048,7 @@
   TerminatorInst *TI = BB->getTerminator();
   if (BranchInst *BI = dyn_cast<BranchInst>(TI)) {
     if (BI->isConditional() && isa<ConstantInt>(BI->getCondition()) &&
-        BI->getCondition()->getType() == Type::BoolTy) {
+        BI->getCondition()->getType() == Type::Int1Ty) {
       bool CondVal = cast<ConstantInt>(BI->getCondition())->getBoolValue();
       AddReachableCodeToWorklist(BI->getSuccessor(!CondVal), Visited, WorkList,
                                  TD);


Index: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
diff -u llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.54 llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.55
--- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.54	Thu Jan 11 06:24:14 2007
+++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp	Thu Jan 11 12:21:29 2007
@@ -486,7 +486,7 @@
   // Insert a conditional branch on LIC to the two preheaders.  The original
   // code is the true version and the new code is the false version.
   Value *BranchVal = LIC;
-  if (Val->getType() != Type::BoolTy)
+  if (Val->getType() != Type::Int1Ty)
     BranchVal = new ICmpInst(ICmpInst::ICMP_EQ, LIC, Val, "tmp", InsertPt);
   else if (Val != ConstantInt::getTrue())
     // We want to enter the new loop when the condition is true.
@@ -919,7 +919,7 @@
 
   // If we know that LIC == Val, or that LIC == NotVal, just replace uses of LIC
   // in the loop with the appropriate one directly.
-  if (IsEqual || (isa<ConstantInt>(Val) && Val->getType() == Type::BoolTy)) {
+  if (IsEqual || (isa<ConstantInt>(Val) && Val->getType() == Type::Int1Ty)) {
     Value *Replacement;
     if (IsEqual)
       Replacement = Val;
@@ -1032,10 +1032,10 @@
       break;
     case Instruction::And:
       if (isa<ConstantInt>(I->getOperand(0)) && 
-          I->getOperand(0)->getType() == Type::BoolTy)   // constant -> RHS
+          I->getOperand(0)->getType() == Type::Int1Ty)   // constant -> RHS
         cast<BinaryOperator>(I)->swapOperands();
       if (ConstantInt *CB = dyn_cast<ConstantInt>(I->getOperand(1))) 
-        if (CB->getType() == Type::BoolTy) {
+        if (CB->getType() == Type::Int1Ty) {
           if (CB->getBoolValue())   // X & 1 -> X
             ReplaceUsesOfWith(I, I->getOperand(0), Worklist);
           else                  // X & 0 -> 0
@@ -1045,10 +1045,10 @@
       break;
     case Instruction::Or:
       if (isa<ConstantInt>(I->getOperand(0)) &&
-          I->getOperand(0)->getType() == Type::BoolTy)   // constant -> RHS
+          I->getOperand(0)->getType() == Type::Int1Ty)   // constant -> RHS
         cast<BinaryOperator>(I)->swapOperands();
       if (ConstantInt *CB = dyn_cast<ConstantInt>(I->getOperand(1)))
-        if (CB->getType() == Type::BoolTy) {
+        if (CB->getType() == Type::Int1Ty) {
           if (CB->getBoolValue())   // X | 1 -> 1
             ReplaceUsesOfWith(I, I->getOperand(1), Worklist);
           else                  // X | 0 -> X


Index: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp
diff -u llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.43 llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.44
--- llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.43	Thu Jan 11 06:24:14 2007
+++ llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp	Thu Jan 11 12:21:29 2007
@@ -1129,9 +1129,9 @@
 
             ConstantInt *CB, *A;
             if ((CB = dyn_cast<ConstantInt>(Canonical)) && 
-                CB->getType() == Type::BoolTy) {
+                CB->getType() == Type::Int1Ty) {
               if ((A = dyn_cast<ConstantInt>(LHS)) &&
-                  A->getType() == Type::BoolTy)
+                  A->getType() == Type::Int1Ty)
                 add(RHS, ConstantInt::get(A->getBoolValue() ^ 
                                           CB->getBoolValue()),
                                           ICmpInst::ICMP_EQ, NewContext);
@@ -1249,7 +1249,7 @@
               if (isa<ConstantInt>(Unknown))
                 One = ConstantInt::get(Ty, 1);
               else if (isa<ConstantInt>(Unknown) && 
-                       Unknown->getType() == Type::BoolTy)
+                       Unknown->getType() == Type::Int1Ty)
                 One = ConstantInt::getTrue();
 
               if (One) add(Unknown, One, ICmpInst::ICMP_EQ, NewContext);


Index: llvm/lib/Transforms/Scalar/SCCP.cpp
diff -u llvm/lib/Transforms/Scalar/SCCP.cpp:1.148 llvm/lib/Transforms/Scalar/SCCP.cpp:1.149
--- llvm/lib/Transforms/Scalar/SCCP.cpp:1.148	Thu Jan 11 06:24:14 2007
+++ llvm/lib/Transforms/Scalar/SCCP.cpp	Thu Jan 11 12:21:29 2007
@@ -417,7 +417,7 @@
       LatticeVal &BCValue = getValueState(BI->getCondition());
       if (BCValue.isOverdefined() ||
           (BCValue.isConstant() && 
-          BCValue.getConstant()->getType() != Type::BoolTy)) {
+          BCValue.getConstant()->getType() != Type::Int1Ty)) {
         // Overdefined condition variables, and branches on unfoldable constant
         // conditions, mean the branch could go either way.
         Succs[0] = Succs[1] = true;
@@ -477,7 +477,7 @@
         return true;
       } else if (BCValue.isConstant()) {
         // Not branching on an evaluatable constant?
-        if (BCValue.getConstant()->getType() != Type::BoolTy) return true;
+        if (BCValue.getConstant()->getType() != Type::Int1Ty) return true;
 
         // Constant condition variables mean the branch can only go a single way
         return BI->getSuccessor(BCValue.getConstant() ==
@@ -648,7 +648,7 @@
   if (CondValue.isUndefined())
     return;
   if (CondValue.isConstant() &&
-      CondValue.getConstant()->getType() == Type::BoolTy) {
+      CondValue.getConstant()->getType() == Type::Int1Ty) {
     if (ConstantInt *CondCB = dyn_cast<ConstantInt>(CondValue.getConstant())){
       mergeInValue(&I, getValueState(CondCB->getBoolValue() ? I.getTrueValue()
                                                           : I.getFalseValue()));






More information about the llvm-commits mailing list