[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu Mar 30 14:02:52 PST 2006



Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.453 -> 1.454
---
Log message:

Fix Transforms/InstCombine/2006-03-30-ExtractElement.ll


---
Diffs of the changes:  (+7 -3)

 InstructionCombining.cpp |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.453 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.454
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.453	Sat Mar 25 15:58:26 2006
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Thu Mar 30 16:02:40 2006
@@ -6704,9 +6704,13 @@
         if (IE->getOperand(2) == EI.getOperand(1))
           return ReplaceInstUsesWith(EI, IE->getOperand(1));
         // If the inserted and extracted elements are constants, they must not
-        // be the same value, replace with the pre-inserted value.
-        if (isa<Constant>(IE->getOperand(2)) && isa<Constant>(EI.getOperand(1)))
-          return ReplaceInstUsesWith(EI, IE->getOperand(0));
+        // be the same value, extract from the pre-inserted value instead.
+        if (isa<Constant>(IE->getOperand(2)) &&
+            isa<Constant>(EI.getOperand(1))) {
+          AddUsesToWorkList(EI);
+          EI.setOperand(0, IE->getOperand(0));
+          return &EI;
+        }
       }
     }
   return 0;






More information about the llvm-commits mailing list