[PATCH] D57161: [RS4GC] Be slightly less conservative for gep vector_base, scalar_idx
Philip Reames via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 24 08:34:11 PST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL352061: [RS4GC] Be slightly less conservative for gep vector_base, scalar_idx (authored by reames, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D57161?vs=183323&id=183326#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57161/new/
https://reviews.llvm.org/D57161
Files:
llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
llvm/trunk/test/Transforms/RewriteStatepointsForGC/base-vector.ll
Index: llvm/trunk/test/Transforms/RewriteStatepointsForGC/base-vector.ll
===================================================================
--- llvm/trunk/test/Transforms/RewriteStatepointsForGC/base-vector.ll
+++ llvm/trunk/test/Transforms/RewriteStatepointsForGC/base-vector.ll
@@ -253,7 +253,7 @@
; CHECK: @llvm.experimental.gc.statepoint.p0f_isVoidf{{.*}}<4 x i64 addrspace(1)*> %vec1)
; CHECK: %vec1.relocated = call coldcc <4 x i8 addrspace(1)*> @llvm.experimental.gc.relocate.v4p1i8
; CHECK: %vec1.relocated.casted = bitcast <4 x i8 addrspace(1)*> %vec1.relocated to <4 x i64 addrspace(1)*>
-; CHECK: %vec2.remat = getelementptr i64, <4 x i64 addrspace(1)*> %vec1.relocated.casted, <4 x i32> <i32 1024, i32 1024, i32 1024, i32 1024>
+; CHECK: %vec2.remat = getelementptr i64, <4 x i64 addrspace(1)*> %vec1.relocated.casted, i32 1024
; CHECK: call void @use_vec(<4 x i64 addrspace(1)*> %vec2.remat)
entry:
%vec2 = getelementptr i64, <4 x i64 addrspace(1)*> %vec1, i32 1024
Index: llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
+++ llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
@@ -2611,21 +2611,20 @@
continue;
unsigned VF = 0;
- bool HasScalarOperand = false;
for (unsigned i = 0; i < I.getNumOperands(); i++)
- if (I.getOperand(i)->getType()->isVectorTy())
+ if (I.getOperand(i)->getType()->isVectorTy()) {
+ assert(VF == 0 ||
+ VF == I.getOperand(i)->getType()->getVectorNumElements());
VF = I.getOperand(i)->getType()->getVectorNumElements();
- else
- HasScalarOperand = true;
+ }
- if (HasScalarOperand && VF != 0) {
+ // It's the vector to scalar traversal through the pointer operand which
+ // confuses base pointer rewriting, so limit ourselves to that case.
+ if (!I.getOperand(0)->getType()->isVectorTy() && VF != 0) {
IRBuilder<> B(&I);
- for (unsigned i = 0; i < I.getNumOperands(); i++)
- if (!I.getOperand(i)->getType()->isVectorTy()) {
- auto *Splat = B.CreateVectorSplat(VF, I.getOperand(i));
- I.setOperand(i, Splat);
- MadeChange = true;
- }
+ auto *Splat = B.CreateVectorSplat(VF, I.getOperand(0));
+ I.setOperand(0, Splat);
+ MadeChange = true;
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57161.183326.patch
Type: text/x-patch
Size: 2418 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190124/020e0582/attachment.bin>
More information about the llvm-commits
mailing list