[llvm-commits] [llvm] r168765 - in /llvm/trunk: lib/Transforms/Vectorize/BBVectorize.cpp test/Transforms/BBVectorize/simple.ll
Hal Finkel
hfinkel at anl.gov
Tue Nov 27 19:04:11 PST 2012
Author: hfinkel
Date: Tue Nov 27 21:04:10 2012
New Revision: 168765
URL: http://llvm.org/viewvc/llvm-project?rev=168765&view=rev
Log:
BBVectorize: Correctly merge SubclassOptionalData
When two instructions are combined into a vector instruction,
the resulting instruction must have the most-conservative flags.
Modified:
llvm/trunk/lib/Transforms/Vectorize/BBVectorize.cpp
llvm/trunk/test/Transforms/BBVectorize/simple.ll
Modified: llvm/trunk/lib/Transforms/Vectorize/BBVectorize.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/BBVectorize.cpp?rev=168765&r1=168764&r2=168765&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Vectorize/BBVectorize.cpp (original)
+++ llvm/trunk/lib/Transforms/Vectorize/BBVectorize.cpp Tue Nov 27 21:04:10 2012
@@ -2903,6 +2903,7 @@
K->mutateType(getVecTypeForPair(L->getType(), H->getType()));
combineMetadata(K, H);
+ K->intersectOptionalDataWith(H);
for (unsigned o = 0; o < NumOperands; ++o)
K->setOperand(o, ReplacedOperands[o]);
Modified: llvm/trunk/test/Transforms/BBVectorize/simple.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/BBVectorize/simple.ll?rev=168765&r1=168764&r2=168765&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/BBVectorize/simple.ll (original)
+++ llvm/trunk/test/Transforms/BBVectorize/simple.ll Tue Nov 27 21:04:10 2012
@@ -173,3 +173,27 @@
; CHECK: ret double %R
}
+; Basic depth-3 chain (subclass data)
+define i64 @test8(i64 %A1, i64 %A2, i64 %B1, i64 %B2) {
+; CHECK: @test8
+; CHECK: %X1.v.i1.1 = insertelement <2 x i64> undef, i64 %B1, i32 0
+; CHECK: %X1.v.i1.2 = insertelement <2 x i64> %X1.v.i1.1, i64 %B2, i32 1
+; CHECK: %X1.v.i0.1 = insertelement <2 x i64> undef, i64 %A1, i32 0
+; CHECK: %X1.v.i0.2 = insertelement <2 x i64> %X1.v.i0.1, i64 %A2, i32 1
+ %X1 = sub nsw i64 %A1, %B1
+ %X2 = sub i64 %A2, %B2
+; CHECK: %X1 = sub <2 x i64> %X1.v.i0.2, %X1.v.i1.2
+ %Y1 = mul i64 %X1, %A1
+ %Y2 = mul i64 %X2, %A2
+; CHECK: %Y1 = mul <2 x i64> %X1, %X1.v.i0.2
+ %Z1 = add i64 %Y1, %B1
+ %Z2 = add i64 %Y2, %B2
+; CHECK: %Z1 = add <2 x i64> %Y1, %X1.v.i1.2
+ %R = mul i64 %Z1, %Z2
+; CHECK: %Z1.v.r1 = extractelement <2 x i64> %Z1, i32 0
+; CHECK: %Z1.v.r2 = extractelement <2 x i64> %Z1, i32 1
+; CHECK: %R = mul i64 %Z1.v.r1, %Z1.v.r2
+ ret i64 %R
+; CHECK: ret i64 %R
+}
+
More information about the llvm-commits
mailing list