Skip to content

Commit 8600d89

Browse files
committed
[DSE] Add test for interaction with return-only captures (NFC)
Regression test for the miscompile reported at: #125880 (comment)
1 parent a33a84e commit 8600d89

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
2+
; RUN: opt -S -passes=dse < %s | FileCheck %s
3+
4+
declare ptr @passthrough(ptr)
5+
6+
define i16 @ret_only() {
7+
; CHECK-LABEL: define i16 @ret_only() {
8+
; CHECK-NEXT: [[A:%.*]] = alloca i16, align 1
9+
; CHECK-NEXT: store i16 1, ptr [[A]], align 1
10+
; CHECK-NEXT: [[CALL:%.*]] = call ptr @passthrough(ptr readnone captures(ret: address, provenance) [[A]])
11+
; CHECK-NEXT: [[V:%.*]] = load i16, ptr [[CALL]], align 1
12+
; CHECK-NEXT: ret i16 [[V]]
13+
;
14+
%a = alloca i16, align 1
15+
store i16 1, ptr %a, align 1
16+
%call = call ptr @passthrough(ptr readnone captures(ret: address, provenance) %a)
17+
%v = load i16, ptr %call, align 1
18+
ret i16 %v
19+
}
20+
21+
define i16 @ret_has_more_components() {
22+
; CHECK-LABEL: define i16 @ret_has_more_components() {
23+
; CHECK-NEXT: [[A:%.*]] = alloca i16, align 1
24+
; CHECK-NEXT: store i16 1, ptr [[A]], align 1
25+
; CHECK-NEXT: [[CALL:%.*]] = call ptr @passthrough(ptr readnone captures(address, ret: address, provenance) [[A]])
26+
; CHECK-NEXT: [[V:%.*]] = load i16, ptr [[CALL]], align 1
27+
; CHECK-NEXT: ret i16 [[V]]
28+
;
29+
%a = alloca i16, align 1
30+
store i16 1, ptr %a, align 1
31+
%call = call ptr @passthrough(ptr readnone captures(address, ret: address, provenance) %a)
32+
%v = load i16, ptr %call, align 1
33+
ret i16 %v
34+
}

0 commit comments

Comments
 (0)