Skip to content

Commit 9e0ea8c

Browse files
committed
[InstCombine] Add extra test for preserving !llvm.access.group
Add variant with different metadata on all loads, for #115868
1 parent 75a04c6 commit 9e0ea8c

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

llvm/test/Transforms/InstCombine/loadstore-metadata.ll

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,28 @@ entry:
272272
%l.b = load double, ptr %b, align 8, !tbaa !0, !llvm.access.group !7
273273
%cmp.i = fcmp fast olt double %l.a, %l.b
274274
%ptr.sel = select i1 %cmp.i, ptr %b, ptr %a
275-
%l.sel = load double, ptr %ptr.sel, align 8, !tbaa !0, !llvm.access.group !12
275+
%l.sel = load double, ptr %ptr.sel, align 8, !tbaa !0, !llvm.access.group !13
276+
ret double %l.sel
277+
}
278+
279+
; FIXME: Should preserve metadata on loads.
280+
; Like preserve_load_metadata_after_select_transform_metadata_missing_3, but
281+
; with different access groups on all loads.
282+
define double @preserve_load_metadata_after_select_transform_metadata_missing_4(ptr %a, ptr %b) {
283+
; CHECK-LABEL: @preserve_load_metadata_after_select_transform_metadata_missing_4(
284+
; CHECK-NEXT: entry:
285+
; CHECK-NEXT: [[L_A:%.*]] = load double, ptr [[A:%.*]], align 8
286+
; CHECK-NEXT: [[L_B:%.*]] = load double, ptr [[B:%.*]], align 8
287+
; CHECK-NEXT: [[CMP_I:%.*]] = fcmp fast olt double [[L_A]], [[L_B]]
288+
; CHECK-NEXT: [[L_SEL:%.*]] = select i1 [[CMP_I]], double [[L_B]], double [[L_A]]
289+
; CHECK-NEXT: ret double [[L_SEL]]
290+
;
291+
entry:
292+
%l.a = load double, ptr %a, align 8, !tbaa !0, !llvm.access.group !7
293+
%l.b = load double, ptr %b, align 8, !tbaa !0, !llvm.access.group !12
294+
%cmp.i = fcmp fast olt double %l.a, %l.b
295+
%ptr.sel = select i1 %cmp.i, ptr %b, ptr %a
296+
%l.sel = load double, ptr %ptr.sel, align 8, !tbaa !0, !llvm.access.group !13
276297
ret double %l.sel
277298
}
278299

@@ -289,6 +310,7 @@ entry:
289310
!10 = distinct !{}
290311
!11 = !{i32 5, i32 6}
291312
!12 = !{}
313+
!13 = !{}
292314
;.
293315
; CHECK: [[TBAA0]] = !{[[LOOP1]], [[LOOP1]], i64 0}
294316
; CHECK: [[LOOP1]] = !{!"scalar type", [[META2:![0-9]+]]}

0 commit comments

Comments
 (0)