[llvm-commits] [llvm] r52212 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp

Matthijs Kooijman matthijs at stdin.nl
Wed Jun 11 02:00:12 PDT 2008


Author: matthijs
Date: Wed Jun 11 04:00:12 2008
New Revision: 52212

URL: http://llvm.org/viewvc/llvm-project?rev=52212&view=rev
Log:
Clarify a comment.

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

Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=52212&r1=52211&r2=52212&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Wed Jun 11 04:00:12 2008
@@ -10613,7 +10613,6 @@
 }
 
 Instruction *InstCombiner::visitExtractElementInst(ExtractElementInst &EI) {
-
   // If vector val is undef, replace extract with scalar undef.
   if (isa<UndefValue>(EI.getOperand(0)))
     return ReplaceInstUsesWith(EI, UndefValue::get(EI.getType()));
@@ -10623,8 +10622,9 @@
     return ReplaceInstUsesWith(EI, Constant::getNullValue(EI.getType()));
   
   if (ConstantVector *C = dyn_cast<ConstantVector>(EI.getOperand(0))) {
-    // If vector val is constant with uniform operands, replace EI
-    // with that operand
+    // If vector val is constant with all elements the same, replace EI with
+    // that element. When the elements are not identical, we cannot replace yet
+    // (we do that below, but only when the index is constant).
     Constant *op0 = C->getOperand(0);
     for (unsigned i = 1; i < C->getNumOperands(); ++i)
       if (C->getOperand(i) != op0) {





More information about the llvm-commits mailing list