[llvm] 292ecb8 - [GVN] Add test for capture via vector GEP (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 5 01:10:00 PST 2023


Author: Nikita Popov
Date: 2023-12-05T10:09:52+01:00
New Revision: 292ecb8b81fbd3784faa237d9f2613e5d962d488

URL: https://github.com/llvm/llvm-project/commit/292ecb8b81fbd3784faa237d9f2613e5d962d488
DIFF: https://github.com/llvm/llvm-project/commit/292ecb8b81fbd3784faa237d9f2613e5d962d488.diff

LOG: [GVN] Add test for capture via vector GEP (NFC)

Reported at:
https://github.com/llvm/llvm-project/pull/69931#issuecomment-1839475854

Added: 
    

Modified: 
    llvm/test/Transforms/GVN/captured-before.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/GVN/captured-before.ll b/llvm/test/Transforms/GVN/captured-before.ll
index 62529b8c1cf62..6db151983cda7 100644
--- a/llvm/test/Transforms/GVN/captured-before.ll
+++ b/llvm/test/Transforms/GVN/captured-before.ll
@@ -132,3 +132,21 @@ loop:
   call void @use(i32 %v) memory(none)
   br label %loop
 }
+
+; FIXME: This is a miscompile.
+define i32 @test_splat_gep_capture(<1 x i32> %index) {
+; CHECK-LABEL: define i32 @test_splat_gep_capture(
+; CHECK-SAME: <1 x i32> [[INDEX:%.*]]) {
+; CHECK-NEXT:    [[A:%.*]] = alloca i32, align 4
+; CHECK-NEXT:    store i32 123, ptr [[A]], align 4
+; CHECK-NEXT:    [[PTRS:%.*]] = getelementptr inbounds i32, ptr [[A]], <1 x i32> [[INDEX]]
+; CHECK-NEXT:    call void @some_call(<1 x ptr> [[PTRS]])
+; CHECK-NEXT:    ret i32 123
+;
+  %a = alloca i32
+  store i32 123, ptr %a
+  %ptrs = getelementptr inbounds i32, ptr %a, <1 x i32> %index
+  call void @some_call(<1 x ptr> %ptrs)
+  %reload = load i32, ptr %a
+  ret i32 %reload
+}


        


More information about the llvm-commits mailing list