[PATCH] D67362: [SLP] limit vectorization of Constant subclasses (PR33958)
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 15 06:07:17 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL371931: [SLP] limit vectorization of Constant subclasses (PR33958) (authored by spatel, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D67362?vs=220150&id=220244#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D67362/new/
https://reviews.llvm.org/D67362
Files:
llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp
llvm/trunk/test/Transforms/SLPVectorizer/X86/consecutive-access.ll
Index: llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -194,10 +194,13 @@
return true;
}
-/// \returns True if all of the values in \p VL are constants.
+/// \returns True if all of the values in \p VL are constants (but not
+/// globals/constant expressions).
static bool allConstant(ArrayRef<Value *> VL) {
+ // Constant expressions and globals can't be vectorized like normal integer/FP
+ // constants.
for (Value *i : VL)
- if (!isa<Constant>(i))
+ if (!isa<Constant>(i) || isa<ConstantExpr>(i) || isa<GlobalValue>(i))
return false;
return true;
}
Index: llvm/trunk/test/Transforms/SLPVectorizer/X86/consecutive-access.ll
===================================================================
--- llvm/trunk/test/Transforms/SLPVectorizer/X86/consecutive-access.ll
+++ llvm/trunk/test/Transforms/SLPVectorizer/X86/consecutive-access.ll
@@ -549,14 +549,17 @@
br i1 %cmp, label %for.body, label %for.cond.cleanup
}
+; Globals/constant expressions are not normal constants.
+; They should not be treated as the usual vectorization candidates.
+
@g1 = external global i32, align 4
@g2 = external global i32, align 4
define void @PR33958(i32** nocapture %p) {
; CHECK-LABEL: @PR33958(
-; CHECK-NEXT: [[ARRAYIDX1:%.*]] = getelementptr inbounds i32*, i32** [[P:%.*]], i64 1
-; CHECK-NEXT: [[TMP1:%.*]] = bitcast i32** [[P]] to <2 x i32*>*
-; CHECK-NEXT: store <2 x i32*> <i32* @g1, i32* @g2>, <2 x i32*>* [[TMP1]], align 8
+; CHECK-NEXT: store i32* @g1, i32** [[P:%.*]], align 8
+; CHECK-NEXT: [[ARRAYIDX1:%.*]] = getelementptr inbounds i32*, i32** [[P]], i64 1
+; CHECK-NEXT: store i32* @g2, i32** [[ARRAYIDX1]], align 8
; CHECK-NEXT: ret void
;
store i32* @g1, i32** %p, align 8
@@ -567,9 +570,9 @@
define void @store_constant_expression(i64* %p) {
; CHECK-LABEL: @store_constant_expression(
-; CHECK-NEXT: [[ARRAYIDX1:%.*]] = getelementptr inbounds i64, i64* [[P:%.*]], i64 1
-; CHECK-NEXT: [[TMP1:%.*]] = bitcast i64* [[P]] to <2 x i64>*
-; CHECK-NEXT: store <2 x i64> <i64 ptrtoint (i32* @g1 to i64), i64 ptrtoint (i32* @g2 to i64)>, <2 x i64>* [[TMP1]], align 8
+; CHECK-NEXT: store i64 ptrtoint (i32* @g1 to i64), i64* [[P:%.*]], align 8
+; CHECK-NEXT: [[ARRAYIDX1:%.*]] = getelementptr inbounds i64, i64* [[P]], i64 1
+; CHECK-NEXT: store i64 ptrtoint (i32* @g2 to i64), i64* [[ARRAYIDX1]], align 8
; CHECK-NEXT: ret void
;
store i64 ptrtoint (i32* @g1 to i64), i64* %p, align 8
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67362.220244.patch
Type: text/x-patch
Size: 2670 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190915/fd967e07/attachment.bin>
More information about the llvm-commits
mailing list