[llvm] r205424 - SLPVectorizer: compare entire intrinsic for SLP compatibility.

Tim Northover tnorthover at apple.com
Wed Apr 2 07:39:02 PDT 2014


Author: tnorthover
Date: Wed Apr  2 09:39:02 2014
New Revision: 205424

URL: http://llvm.org/viewvc/llvm-project?rev=205424&view=rev
Log:
SLPVectorizer: compare entire intrinsic for SLP compatibility.

Some Intrinsics are overloaded to the extent that return type equality (all
that's been checked up to now) does not guarantee that the arguments are the
same. In these cases SLP vectorizer should not recurse into the operands, which
can be achieved by comparing them as "Function *" rather than simply the ID.

Added:
    llvm/trunk/test/Transforms/SLPVectorizer/ARM64/
    llvm/trunk/test/Transforms/SLPVectorizer/ARM64/lit.local.cfg
    llvm/trunk/test/Transforms/SLPVectorizer/ARM64/mismatched-intrinsics.ll
Modified:
    llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp

Modified: llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp?rev=205424&r1=205423&r2=205424&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp Wed Apr  2 09:39:02 2014
@@ -955,11 +955,11 @@ void BoUpSLP::buildTree_rec(ArrayRef<Val
         return;
       }
 
-      Intrinsic::ID ID = II->getIntrinsicID();
+      Function *Int = II->getCalledFunction();
 
       for (unsigned i = 1, e = VL.size(); i != e; ++i) {
         IntrinsicInst *II2 = dyn_cast<IntrinsicInst>(VL[i]);
-        if (!II2 || II2->getIntrinsicID() != ID) {
+        if (!II2 || II2->getCalledFunction() != Int) {
           newTreeEntry(VL, false);
           DEBUG(dbgs() << "SLP: mismatched calls:" << *II << "!=" << *VL[i]
                        << "\n");

Added: llvm/trunk/test/Transforms/SLPVectorizer/ARM64/lit.local.cfg
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SLPVectorizer/ARM64/lit.local.cfg?rev=205424&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/SLPVectorizer/ARM64/lit.local.cfg (added)
+++ llvm/trunk/test/Transforms/SLPVectorizer/ARM64/lit.local.cfg Wed Apr  2 09:39:02 2014
@@ -0,0 +1,3 @@
+targets = set(config.root.targets_to_build.split())
+if not 'ARM64' in targets:
+    config.unsupported = True

Added: llvm/trunk/test/Transforms/SLPVectorizer/ARM64/mismatched-intrinsics.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SLPVectorizer/ARM64/mismatched-intrinsics.ll?rev=205424&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/SLPVectorizer/ARM64/mismatched-intrinsics.ll (added)
+++ llvm/trunk/test/Transforms/SLPVectorizer/ARM64/mismatched-intrinsics.ll Wed Apr  2 09:39:02 2014
@@ -0,0 +1,18 @@
+; RUN: opt -S -slp-vectorizer %s | FileCheck %s
+target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
+target triple = "arm64-apple-ios5.0.0"
+
+define i64 @mismatched_intrinsics(<4 x i32> %in1, <2 x i32> %in2) nounwind {
+; CHECK-LABEL: @mismatched_intrinsics
+; CHECK: call i64 @llvm.arm64.neon.saddlv.i64.v4i32
+; CHECK: call i64 @llvm.arm64.neon.saddlv.i64.v2i32
+
+  %vaddlvq_s32.i = tail call i64 @llvm.arm64.neon.saddlv.i64.v4i32(<4 x i32> %in1) #2
+  %vaddlv_s32.i = tail call i64 @llvm.arm64.neon.saddlv.i64.v2i32(<2 x i32> %in2) #2
+  %tst = icmp sgt i64 %vaddlvq_s32.i, %vaddlv_s32.i
+  %equal = sext i1 %tst to i64
+  ret i64 %equal
+}
+
+declare i64 @llvm.arm64.neon.saddlv.i64.v4i32(<4 x i32> %in1)
+declare i64 @llvm.arm64.neon.saddlv.i64.v2i32(<2 x i32> %in1)





More information about the llvm-commits mailing list