[llvm-branch-commits] [llvm-branch] r113680 - /llvm/branches/ggreif/waymark-64/lib/Transforms/Scalar/CodeGenPrepare.cpp

Gabor Greif ggreif at gmail.com
Sat Sep 11 01:01:02 PDT 2010


Author: ggreif
Date: Sat Sep 11 03:01:01 2010
New Revision: 113680

URL: http://llvm.org/viewvc/llvm-project?rev=113680&view=rev
Log:
clean-up

Modified:
    llvm/branches/ggreif/waymark-64/lib/Transforms/Scalar/CodeGenPrepare.cpp

Modified: llvm/branches/ggreif/waymark-64/lib/Transforms/Scalar/CodeGenPrepare.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/waymark-64/lib/Transforms/Scalar/CodeGenPrepare.cpp?rev=113680&r1=113679&r2=113680&view=diff
==============================================================================
--- llvm/branches/ggreif/waymark-64/lib/Transforms/Scalar/CodeGenPrepare.cpp (original)
+++ llvm/branches/ggreif/waymark-64/lib/Transforms/Scalar/CodeGenPrepare.cpp Sat Sep 11 03:01:01 2010
@@ -898,11 +898,8 @@
   if (condition != --BasicBlock::iterator(I))
     return false;
 
-  static bool once(true);
   const Type *Ty = condition->getType();
 
-
-
   if (TruncInst *T = dyn_cast<TruncInst>(condition)) {
     condition = T->getOperand(0); 
     if (condition != --BasicBlock::iterator(T)/*&& TODO: CHEAP TRUNCATES*/)
@@ -913,23 +910,17 @@
     if (A->getOpcode() == Instruction::And) {
       ConstantInt *Zero(cast<ConstantInt>(ConstantInt::get(Ty, 0)));
       if (unsigned Leg = I->findCaseValue(Zero)) {
-      //  I->removeCase(Leg);
-BasicBlock *New = Old->splitBasicBlock(I, Old->getName()+".switch");        
-TerminatorInst *T = Old->getTerminator();
-T->eraseFromParent();
-Instruction *Cmp = new ICmpInst(*Old, CmpInst::ICMP_EQ, I->getCondition(), Zero, "tst");
-BranchInst::Create(I->getSuccessor(Leg), New, Cmp, Old);
-I->removeCase(Leg);
-return true;
+        BasicBlock *New = Old->splitBasicBlock(I, Old->getName()+".switch");        
+        Old->getTerminator()->eraseFromParent();
+        Instruction *Cmp = new ICmpInst(*Old, CmpInst::ICMP_EQ, I->getCondition(), Zero, "tst");
+        BranchInst::Create(I->getSuccessor(Leg), New, Cmp, Old);
+        I->removeCase(Leg);
+        return true;
       }
     }
   }
 
-
-// unsigned 	findCaseValue (const ConstantInt *C) const
-//void 	removeCase (unsigned idx)
-
-  return false; // once | (once = false);
+  return false;
 }
 
 





More information about the llvm-branch-commits mailing list