[llvm-commits] [llvm] r155480 - in /llvm/trunk: lib/VMCore/ConstantFold.cpp test/Transforms/InstCombine/2012-04-24-vselect.ll
Nadav Rotem
nadav.rotem at intel.com
Tue Apr 24 13:18:49 PDT 2012
Author: nadav
Date: Tue Apr 24 15:18:49 2012
New Revision: 155480
URL: http://llvm.org/viewvc/llvm-project?rev=155480&view=rev
Log:
ConstantFoldSelectInstruction swapped the operands of the select.
Fix 12592. Patch by Matt Pharr.
Added:
llvm/trunk/test/Transforms/InstCombine/2012-04-24-vselect.ll
Modified:
llvm/trunk/lib/VMCore/ConstantFold.cpp
Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantFold.cpp?rev=155480&r1=155479&r2=155480&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/ConstantFold.cpp (original)
+++ llvm/trunk/lib/VMCore/ConstantFold.cpp Tue Apr 24 15:18:49 2012
@@ -700,7 +700,7 @@
ConstantInt *Cond = dyn_cast<ConstantInt>(CondV->getOperand(i));
if (Cond == 0) break;
- Constant *Res = (Cond->getZExtValue() ? V2 : V1)->getAggregateElement(i);
+ Constant *Res = (Cond->getZExtValue() ? V1 : V2)->getAggregateElement(i);
if (Res == 0) break;
Result.push_back(Res);
}
Added: llvm/trunk/test/Transforms/InstCombine/2012-04-24-vselect.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2012-04-24-vselect.ll?rev=155480&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/2012-04-24-vselect.ll (added)
+++ llvm/trunk/test/Transforms/InstCombine/2012-04-24-vselect.ll Tue Apr 24 15:18:49 2012
@@ -0,0 +1,13 @@
+; RUN: opt -instcombine -S < %s | FileCheck %s
+
+; CHECK: @foo
+; CHECK: <i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+
+define <8 x i32> @foo() nounwind {
+entry:
+ %v1.i = select <8 x i1> <i1 true, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false>,
+ <8 x i32> <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>,
+ <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ ret <8 x i32> %v1.i
+}
+
More information about the llvm-commits
mailing list