Skip to content

Commit 6016775

Browse files
committed
Apply suggestions
1 parent 5569ace commit 6016775

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -574,10 +574,8 @@ Instruction *InstCombinerImpl::foldPHIArgGEPIntoPHI(PHINode &PN) {
574574
// substantially cheaper to compute for the constants, so making it a
575575
// variable index could pessimize the path. This also handles the case
576576
// for struct indices, which must always be constant.
577-
if (isa<ConstantInt>(FirstInst->getOperand(Op)) ||
578-
isa<ConstantInt>(GEP->getOperand(Op)) ||
579-
isa<ConstantDataVector>(FirstInst->getOperand(Op)) ||
580-
isa<ConstantDataVector>(GEP->getOperand(Op)))
577+
if (isa<Constant>(FirstInst->getOperand(Op)) ||
578+
isa<Constant>(GEP->getOperand(Op)))
581579
return nullptr;
582580

583581
if (FirstInst->getOperand(Op)->getType() !=

llvm/test/Transforms/InstCombine/fold-phi-arg-gep-to-phi-negative.ll

+5-9
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
%vec_base = type { [4 x float] }
55
%foo = type { %vec, %vec}
66

7-
define void @test(i1 %tobool, ptr addrspace(1) %add.ptr.i) {
7+
define void @test(i1 %tobool, ptr addrspace(1) %add.ptr) {
88
entry:
99
%lane.0 = alloca %foo, align 16
10-
%lane.15 = insertelement <16 x ptr> undef, ptr %lane.0, i64 0
10+
%lane.15 = insertelement <16 x ptr> poison, ptr %lane.0, i64 0
1111
%mm_vectorGEP = getelementptr inbounds %foo, <16 x ptr> %lane.15, <16 x i64> zeroinitializer, <16 x i32> splat (i32 1), <16 x i32> zeroinitializer, <16 x i32> zeroinitializer, <16 x i64> splat (i64 1)
1212
%mm_vectorGEP2 = getelementptr inbounds %foo, <16 x ptr> %lane.15, <16 x i64> zeroinitializer, <16 x i32> zeroinitializer, <16 x i32> zeroinitializer, <16 x i32> zeroinitializer, <16 x i64> splat (i64 1)
1313
br i1 %tobool, label %f1, label %f0
@@ -24,12 +24,8 @@ f1:
2424

2525
merge:
2626
; CHECK: merge:
27-
; CHECK-NEXT: %vec.phi14 = phi <16 x ptr> [ %mm_vectorGEP, %f0 ], [ %mm_vectorGEP2, %f1 ]
28-
%vec.phi14 = phi <16 x ptr> [ %mm_vectorGEP, %f0], [ %mm_vectorGEP2, %f1 ]
29-
%wide.masked.gather15 = call <16 x float> @llvm.masked.gather.v16f32.v16p0(<16 x ptr> %vec.phi14, i32 4, <16 x i1> splat (i1 true), <16 x float> poison)
30-
%wide.masked.gather15.extract.15. = extractelement <16 x float> %wide.masked.gather15, i32 15
31-
store float %wide.masked.gather15.extract.15., ptr addrspace(1) %add.ptr.i, align 4
27+
; CHECK-NEXT: %vec.phi = phi <16 x ptr> [ %mm_vectorGEP, %f0 ], [ %mm_vectorGEP2, %f1 ]
28+
%vec.phi = phi <16 x ptr> [ %mm_vectorGEP, %f0], [ %mm_vectorGEP2, %f1 ]
29+
store <16 x ptr> %vec.phi, ptr addrspace(1) %add.ptr
3230
ret void
3331
}
34-
35-
declare <16 x float> @llvm.masked.gather.v16f32.v16p0(<16 x ptr>, i32 immarg, <16 x i1>, <16 x float>)

0 commit comments

Comments
 (0)