[llvm] r245419 - Clean up this file a little. Remove dead casts, casting Values to Values. Adjust some comments for typos and whitespace. NFC.

Nick Lewycky via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 18 23:22:34 PDT 2015


Author: nicholas
Date: Wed Aug 19 01:22:33 2015
New Revision: 245419

URL: http://llvm.org/viewvc/llvm-project?rev=245419&view=rev
Log:
Clean up this file a little. Remove dead casts, casting Values to Values. Adjust some comments for typos and whitespace. NFC.

Modified:
    llvm/trunk/lib/Transforms/Scalar/LoopIdiomRecognize.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopIdiomRecognize.cpp?rev=245419&r1=245418&r2=245419&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopIdiomRecognize.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopIdiomRecognize.cpp Wed Aug 19 01:22:33 2015
@@ -918,8 +918,8 @@ void LoopIdiomRecognize::transformLoopTo
     }
   }
 
-  // Step 2: Replace the precondition from "if(x == 0) goto loop-exit" to
-  //   "if(NewCount == 0) loop-exit". Withtout this change, the intrinsic
+  // Step 2: Replace the precondition from "if (x == 0) goto loop-exit" to
+  //   "if (NewCount == 0) loop-exit". Withtout this change, the intrinsic
   //   function would be partial dead code, and downstream passes will drag
   //   it back from the precondition block to the preheader.
   {
@@ -941,9 +941,9 @@ void LoopIdiomRecognize::transformLoopTo
   // loop in question, which enble us to to convert the loop from noncountable
   // loop into a countable one. The benefit is twofold:
   //
-  //  - If the loop only counts population, the entire loop become dead after
-  //    the transformation. It is lots easier to prove a countable loop dead
-  //    than to prove a noncountable one. (In some C dialects, a infite loop
+  //  - If the loop only counts population, the entire loop becomes dead after
+  //    the transformation. It is a lot easier to prove a countable loop dead
+  //    than to prove a noncountable one. (In some C dialects, an infinite loop
   //    isn't dead even if it computes nothing useful. In general, DCE needs
   //    to prove a noncountable loop finite before safely delete it.)
   //
@@ -966,8 +966,8 @@ void LoopIdiomRecognize::transformLoopTo
     PHINode *TcPhi = PHINode::Create(Ty, 2, "tcphi", Body->begin());
 
     Builder.SetInsertPoint(LbCond);
-    Value *Opnd1 = cast<Value>(TcPhi);
-    Value *Opnd2 = cast<Value>(ConstantInt::get(Ty, 1));
+    Value *Opnd1 = TcPhi;
+    Value *Opnd2 = ConstantInt::get(Ty, 1);
     Instruction *TcDec = cast<Instruction>(
         Builder.CreateSub(Opnd1, Opnd2, "tcdec", false, true));
 
@@ -978,7 +978,7 @@ void LoopIdiomRecognize::transformLoopTo
         (LbBr->getSuccessor(0) == Body) ? CmpInst::ICMP_UGT : CmpInst::ICMP_SLE;
     LbCond->setPredicate(Pred);
     LbCond->setOperand(0, TcDec);
-    LbCond->setOperand(1, cast<Value>(ConstantInt::get(Ty, 0)));
+    LbCond->setOperand(1, ConstantInt::get(Ty, 0));
   }
 
   // Step 4: All the references to the original population counter outside




More information about the llvm-commits mailing list