xref: /llvm-project/llvm/test/Transforms/InstCombine/call-undef.ll (revision 18de7c6a3b3689bf69215429bde1fb2330a3e69d)
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -passes=instcombine -S | FileCheck %s
3
4declare void @c(i32 noundef)
5declare void @d(ptr dereferenceable(1))
6declare void @e(i32)
7declare void @f(ptr)
8
9define void @test1() {
10; CHECK-LABEL: @test1(
11; CHECK-NEXT:    call void @c(i32 undef)
12; CHECK-NEXT:    ret void
13;
14  call void @c(i32 undef)
15  ret void
16}
17
18define void @test2() {
19; CHECK-LABEL: @test2(
20; CHECK-NEXT:    call void @c(i32 poison)
21; CHECK-NEXT:    ret void
22;
23  call void @c(i32 poison)
24  ret void
25}
26
27define void @test3() {
28; CHECK-LABEL: @test3(
29; CHECK-NEXT:    call void @e(i32 noundef undef)
30; CHECK-NEXT:    ret void
31;
32  call void @e(i32 noundef undef)
33  ret void
34}
35
36define void @test4() {
37; CHECK-LABEL: @test4(
38; CHECK-NEXT:    call void @e(i32 noundef poison)
39; CHECK-NEXT:    ret void
40;
41  call void @e(i32 noundef poison)
42  ret void
43}
44
45define void @test5() {
46; CHECK-LABEL: @test5(
47; CHECK-NEXT:    call void @d(ptr undef)
48; CHECK-NEXT:    ret void
49;
50  call void @d(ptr undef)
51  ret void
52}
53
54define void @test6() {
55; CHECK-LABEL: @test6(
56; CHECK-NEXT:    call void @d(ptr poison)
57; CHECK-NEXT:    ret void
58;
59  call void @d(ptr poison)
60  ret void
61}
62
63define void @test7() {
64; CHECK-LABEL: @test7(
65; CHECK-NEXT:    call void @f(ptr dereferenceable(1) undef)
66; CHECK-NEXT:    ret void
67;
68  call void @f(ptr dereferenceable(1) undef)
69  ret void
70}
71
72define void @test8() {
73; CHECK-LABEL: @test8(
74; CHECK-NEXT:    call void @f(ptr dereferenceable(1) poison)
75; CHECK-NEXT:    ret void
76;
77  call void @f(ptr dereferenceable(1) poison)
78  ret void
79}
80
81define void @test_mismatched_call() {
82; CHECK-LABEL: @test_mismatched_call(
83; CHECK-NEXT:    call void @e(i8 poison)
84; CHECK-NEXT:    ret void
85;
86  call void @e(i8 poison)
87  ret void
88}
89