remove the AllowAggressive argument to FoldOpIntoPhi. It is forced to false in the
authorChris Lattner <sabre@nondot.org>
Sun, 16 Jan 2011 05:14:26 +0000 (05:14 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 16 Jan 2011 05:14:26 +0000 (05:14 +0000)
first line of the function because it isn't a good idea, even for compares.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123566 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/InstCombine/InstCombine.h
lib/Transforms/InstCombine/InstCombineCompares.cpp
lib/Transforms/InstCombine/InstructionCombining.cpp

index 81b5b7ea6df9ee0f89701e858c97bd0e36332633..450e7f0a398bcb1ceec404f554b188aae45cd41a 100644 (file)
@@ -319,10 +319,7 @@ private:
   // into the PHI (which is only possible if all operands to the PHI are
   // constants).
   //
-  // If AllowAggressive is true, FoldOpIntoPhi will allow certain transforms
-  // that would normally be unprofitable because they strongly encourage jump
-  // threading.
-  Instruction *FoldOpIntoPhi(Instruction &I, bool AllowAggressive = false);
+  Instruction *FoldOpIntoPhi(Instruction &I);
 
   // FoldPHIArgOpIntoPHI - If all operands to a PHI node are the same "unary"
   // operator and they all are only used by the PHI, PHI together their
index 471687a24372234183c2473aed793f1b62c3f3e8..73ae197c833253ed8c109aa714b5f86afd8f7425 100644 (file)
@@ -2125,7 +2125,7 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) {
         // block.  If in the same block, we're encouraging jump threading.  If
         // not, we are just pessimizing the code by making an i1 phi.
         if (LHSI->getParent() == I.getParent())
-          if (Instruction *NV = FoldOpIntoPhi(I, true))
+          if (Instruction *NV = FoldOpIntoPhi(I))
             return NV;
         break;
       case Instruction::Select: {
@@ -2648,7 +2648,7 @@ Instruction *InstCombiner::visitFCmpInst(FCmpInst &I) {
         // block.  If in the same block, we're encouraging jump threading.  If
         // not, we are just pessimizing the code by making an i1 phi.
         if (LHSI->getParent() == I.getParent())
-          if (Instruction *NV = FoldOpIntoPhi(I, true))
+          if (Instruction *NV = FoldOpIntoPhi(I))
             return NV;
         break;
       case Instruction::SIToFP:
index 919c623c6041d8d2598d74f0c07b18f3180f1999..6d05466b9becb8639f9ac60b748815771c034a83 100644 (file)
@@ -512,12 +512,7 @@ Instruction *InstCombiner::FoldOpIntoSelect(Instruction &Op, SelectInst *SI) {
 /// has a PHI node as operand #0, see if we can fold the instruction into the
 /// PHI (which is only possible if all operands to the PHI are constants).
 ///
-/// If AllowAggressive is true, FoldOpIntoPhi will allow certain transforms
-/// that would normally be unprofitable because they strongly encourage jump
-/// threading.
-Instruction *InstCombiner::FoldOpIntoPhi(Instruction &I,
-                                         bool AllowAggressive) {
-  AllowAggressive = false;
+Instruction *InstCombiner::FoldOpIntoPhi(Instruction &I) {
   PHINode *PN = cast<PHINode>(I.getOperand(0));
   unsigned NumPHIValues = PN->getNumIncomingValues();
   if (NumPHIValues == 0)
@@ -525,7 +520,7 @@ Instruction *InstCombiner::FoldOpIntoPhi(Instruction &I,
   
   // We normally only transform phis with a single use, unless we're trying
   // hard to make jump threading happen.
-  if (!PN->hasOneUse() && !AllowAggressive)
+  if (!PN->hasOneUse())
     return 0;
   
   // Check to see if all of the operands of the PHI are simple constants
@@ -560,7 +555,7 @@ Instruction *InstCombiner::FoldOpIntoPhi(Instruction &I,
   // operation in that block.  However, if this is a critical edge, we would be
   // inserting the computation one some other paths (e.g. inside a loop).  Only
   // do this if the pred block is unconditionally branching into the phi block.
-  if (NonConstBB != 0 && !AllowAggressive) {
+  if (NonConstBB != 0) {
     BranchInst *BI = dyn_cast<BranchInst>(NonConstBB->getTerminator());
     if (!BI || !BI->isUnconditional()) return 0;
   }