llvm.org GIT mirror llvm / 0332ddd
[RS4GC] Be slightly less conservative for gep vector_base, scalar_idx After submitting https://reviews.llvm.org/D57138, I realized it was slightly more conservative than needed. The scalar indices don't appear to be a problem on a vector gep, we even had a test for that. Differential Revision: https://reviews.llvm.org/D57161 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352061 91177308-0d34-0410-b5e6-96231b3b80d8 Philip Reames 7 months ago
2 changed file(s) with 12 addition(s) and 13 deletion(s). Raw diff Collapse all Expand all
26102610 continue;
26112611
26122612 unsigned VF = 0;
2613 bool HasScalarOperand = false;
26142613 for (unsigned i = 0; i < I.getNumOperands(); i++)
2615 if (I.getOperand(i)->getType()->isVectorTy())
2614 if (I.getOperand(i)->getType()->isVectorTy()) {
2615 assert(VF == 0 ||
2616 VF == I.getOperand(i)->getType()->getVectorNumElements());
26162617 VF = I.getOperand(i)->getType()->getVectorNumElements();
2617 else
2618 HasScalarOperand = true;
2619
2620 if (HasScalarOperand && VF != 0) {
2618 }
2619
2620 // It's the vector to scalar traversal through the pointer operand which
2621 // confuses base pointer rewriting, so limit ourselves to that case.
2622 if (!I.getOperand(0)->getType()->isVectorTy() && VF != 0) {
26212623 IRBuilder<> B(&I);
2622 for (unsigned i = 0; i < I.getNumOperands(); i++)
2623 if (!I.getOperand(i)->getType()->isVectorTy()) {
2624 auto *Splat = B.CreateVectorSplat(VF, I.getOperand(i));
2625 I.setOperand(i, Splat);
2626 MadeChange = true;
2627 }
2624 auto *Splat = B.CreateVectorSplat(VF, I.getOperand(0));
2625 I.setOperand(0, Splat);
2626 MadeChange = true;
26282627 }
26292628 }
26302629
252252 ; CHECK: @llvm.experimental.gc.statepoint.p0f_isVoidf{{.*}}<4 x i64 addrspace(1)*> %vec1)
253253 ; CHECK: %vec1.relocated = call coldcc <4 x i8 addrspace(1)*> @llvm.experimental.gc.relocate.v4p1i8
254254 ; CHECK: %vec1.relocated.casted = bitcast <4 x i8 addrspace(1)*> %vec1.relocated to <4 x i64 addrspace(1)*>
255 ; CHECK: %vec2.remat = getelementptr i64, <4 x i64 addrspace(1)*> %vec1.relocated.casted, <4 x i32>
255 ; CHECK: %vec2.remat = getelementptr i64, <4 x i64 addrspace(1)*> %vec1.relocated.casted, i32 1024
256256 ; CHECK: call void @use_vec(<4 x i64 addrspace(1)*> %vec2.remat)
257257 entry:
258258 %vec2 = getelementptr i64, <4 x i64 addrspace(1)*> %vec1, i32 1024