Skip to content

Commit 292ecb8

Browse files
committed
[GVN] Add test for capture via vector GEP (NFC)
Reported at: #69931 (comment)
1 parent 892abd3 commit 292ecb8

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,21 @@ loop:
132132
call void @use(i32 %v) memory(none)
133133
br label %loop
134134
}
135+
136+
; FIXME: This is a miscompile.
137+
define i32 @test_splat_gep_capture(<1 x i32> %index) {
138+
; CHECK-LABEL: define i32 @test_splat_gep_capture(
139+
; CHECK-SAME: <1 x i32> [[INDEX:%.*]]) {
140+
; CHECK-NEXT: [[A:%.*]] = alloca i32, align 4
141+
; CHECK-NEXT: store i32 123, ptr [[A]], align 4
142+
; CHECK-NEXT: [[PTRS:%.*]] = getelementptr inbounds i32, ptr [[A]], <1 x i32> [[INDEX]]
143+
; CHECK-NEXT: call void @some_call(<1 x ptr> [[PTRS]])
144+
; CHECK-NEXT: ret i32 123
145+
;
146+
%a = alloca i32
147+
store i32 123, ptr %a
148+
%ptrs = getelementptr inbounds i32, ptr %a, <1 x i32> %index
149+
call void @some_call(<1 x ptr> %ptrs)
150+
%reload = load i32, ptr %a
151+
ret i32 %reload
152+
}

0 commit comments

Comments
 (0)