xref: /llvm-project/llvm/test/tools/llvm-reduce/no-replace-intrinsic-callee-with-undef.ll (revision 1437a83491cbe4af1b452a3f862a6b609057c26d)
1; Intrinsic calls can't be uniformly replaced with undef without invalidating
2; IR (eg: only intrinsic calls can have metadata arguments), so ensure they are
3; not replaced. The whole call instruction can be removed by instruction
4; reduction instead.
5
6; RUN: llvm-reduce --abort-on-invalid-reduction --delta-passes=functions,instructions --test FileCheck --test-arg --check-prefixes=ALL,CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t 2> %t.log
7; RUN: FileCheck -implicit-check-not=uninteresting --check-prefixes=ALL,CHECK-FINAL %s < %t
8
9; Check that the call is removed by instruction reduction passes
10; RUN: llvm-reduce --abort-on-invalid-reduction --delta-passes=functions,instructions --test FileCheck --test-arg --check-prefix=ALL --test-arg %s --test-arg --input-file %s -o %t
11; RUN: FileCheck -implicit-check-not=uninteresting --check-prefixes=ALL,CHECK-NOCALL %s < %t
12
13
14declare ptr @llvm.sponentry.p0()
15declare i8 @uninteresting()
16
17; ALL-LABEL: define ptr @interesting(
18define ptr @interesting() {
19entry:
20  ; CHECK-INTERESTINGNESS: call ptr
21  ; CHECK-NOCALL-NOT: call i8
22
23  ; CHECK-FINAL: %call = call ptr @llvm.sponentry.p0()
24  ; CHECK-FINAL-NEXT: ret ptr %call
25  %call = call ptr @llvm.sponentry.p0()
26  call i8 @uninteresting()
27  ret ptr %call
28}
29