[llvm] 9e0ea8c - [InstCombine] Add extra test for preserving !llvm.access.group

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 19 05:11:04 PST 2024


Author: Florian Hahn
Date: 2024-11-19T13:10:50Z
New Revision: 9e0ea8c8816d9f5837ad3357be32dddce28c7fb1

URL: https://github.com/llvm/llvm-project/commit/9e0ea8c8816d9f5837ad3357be32dddce28c7fb1
DIFF: https://github.com/llvm/llvm-project/commit/9e0ea8c8816d9f5837ad3357be32dddce28c7fb1.diff

LOG: [InstCombine] Add extra test for preserving !llvm.access.group

Add variant with different metadata on all loads, for
https://github.com/llvm/llvm-project/pull/115868

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/loadstore-metadata.ll b/llvm/test/Transforms/InstCombine/loadstore-metadata.ll
index dc9daf5265d370..29fc5bc7bf87ae 100644
--- a/llvm/test/Transforms/InstCombine/loadstore-metadata.ll
+++ b/llvm/test/Transforms/InstCombine/loadstore-metadata.ll
@@ -272,7 +272,28 @@ entry:
   %l.b = load double, ptr %b, align 8, !tbaa !0, !llvm.access.group !7
   %cmp.i = fcmp fast olt double %l.a, %l.b
   %ptr.sel = select i1 %cmp.i, ptr %b, ptr %a
-  %l.sel = load double, ptr %ptr.sel, align 8, !tbaa !0, !llvm.access.group !12
+  %l.sel = load double, ptr %ptr.sel, align 8, !tbaa !0, !llvm.access.group !13
+  ret double %l.sel
+}
+
+; FIXME: Should preserve metadata on loads.
+; Like preserve_load_metadata_after_select_transform_metadata_missing_3, but
+; with 
diff erent access groups on all loads.
+define double @preserve_load_metadata_after_select_transform_metadata_missing_4(ptr %a, ptr %b) {
+; CHECK-LABEL: @preserve_load_metadata_after_select_transform_metadata_missing_4(
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:    [[L_A:%.*]] = load double, ptr [[A:%.*]], align 8
+; CHECK-NEXT:    [[L_B:%.*]] = load double, ptr [[B:%.*]], align 8
+; CHECK-NEXT:    [[CMP_I:%.*]] = fcmp fast olt double [[L_A]], [[L_B]]
+; CHECK-NEXT:    [[L_SEL:%.*]] = select i1 [[CMP_I]], double [[L_B]], double [[L_A]]
+; CHECK-NEXT:    ret double [[L_SEL]]
+;
+entry:
+  %l.a = load double, ptr %a, align 8, !tbaa !0, !llvm.access.group !7
+  %l.b = load double, ptr %b, align 8, !tbaa !0, !llvm.access.group !12
+  %cmp.i = fcmp fast olt double %l.a, %l.b
+  %ptr.sel = select i1 %cmp.i, ptr %b, ptr %a
+  %l.sel = load double, ptr %ptr.sel, align 8, !tbaa !0, !llvm.access.group !13
   ret double %l.sel
 }
 
@@ -289,6 +310,7 @@ entry:
 !10 = distinct !{}
 !11 = !{i32 5, i32 6}
 !12 = !{}
+!13 = !{}
 ;.
 ; CHECK: [[TBAA0]] = !{[[LOOP1]], [[LOOP1]], i64 0}
 ; CHECK: [[LOOP1]] = !{!"scalar type", [[META2:![0-9]+]]}


        


More information about the llvm-commits mailing list