Skip to content

Commit a3a6f9f

Browse files
committed
Remove pointer check and extra test
1 parent 8f7fe4a commit a3a6f9f

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

llvm/lib/Transforms/Scalar/GVN.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2311,8 +2311,6 @@ bool GVNPass::processMaskedLoad(IntrinsicInst *I) {
23112311
ICF->removeUsersOf(I);
23122312
I->replaceAllUsesWith(OpToForward);
23132313
salvageAndRemoveInstruction(I);
2314-
if (OpToForward->getType()->isPtrOrPtrVectorTy())
2315-
MD->invalidateCachedPointerInfo(OpToForward);
23162314
++NumGVNLoad;
23172315
return true;
23182316
}

llvm/test/Transforms/GVN/masked-load-store.ll

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,19 @@ define <4 x float> @forward_masked_load(ptr %0, ptr %1) {
4949
ret <4 x float> %load2
5050
}
5151

52+
define <4 x float> @forward_masked_load_arbitrary_mask(ptr %loc_a, ptr %loc_b, <4 x i1> %mask) {
53+
; CHECK-LABEL: @forward_masked_load_arbitrary_mask(
54+
; CHECK-NEXT: [[LOAD1:%.*]] = call <4 x float> @llvm.masked.load.v4f32.p0(ptr [[LOC_A:%.*]], i32 1, <4 x i1> [[MASK:%.*]], <4 x float> zeroinitializer)
55+
; CHECK-NEXT: call void @llvm.masked.store.v4f32.p0(<4 x float> [[LOAD1]], ptr [[LOC_B:%.*]], i32 1, <4 x i1> [[MASK]])
56+
; CHECK-NEXT: [[TMP1:%.*]] = select <4 x i1> [[MASK]], <4 x float> [[LOAD1]], <4 x float> zeroinitializer
57+
; CHECK-NEXT: ret <4 x float> [[TMP1]]
58+
;
59+
%load1 = call <4 x float> @llvm.masked.load.v4f32.p0(ptr %loc_a, i32 1, <4 x i1> %mask, <4 x float> zeroinitializer)
60+
call void @llvm.masked.store.v4f32.p0(<4 x float> %load1, ptr %loc_b, i32 1, <4 x i1> %mask)
61+
%load2 = call <4 x float> @llvm.masked.load.v4f32.p0(ptr %loc_b, i32 1, <4 x i1> %mask, <4 x float> zeroinitializer)
62+
ret <4 x float> %load2
63+
}
64+
5265
define <4 x float> @forward_binop_splat_i1_mask(ptr %0, ptr %1) {
5366
; CHECK-LABEL: @forward_binop_splat_i1_mask(
5467
; CHECK-NEXT: [[LOAD_0_0:%.*]] = call <4 x float> @llvm.masked.load.v4f32.p0(ptr [[TMP0:%.*]], i32 1, <4 x i1> splat (i1 true), <4 x float> zeroinitializer)

0 commit comments

Comments
 (0)