xref: /aosp_15_r20/external/llvm/test/Transforms/DeadArgElim/canon.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; This test shows a few canonicalizations made by deadargelim
2*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -deadargelim -S > %t
3*9880d681SAndroid Build Coastguard Worker; This test should remove {} and replace it with void
4*9880d681SAndroid Build Coastguard Worker; RUN: cat %t | grep "define internal void @test"
5*9880d681SAndroid Build Coastguard Worker; This test shouls replace the {i32} return value with just i32
6*9880d681SAndroid Build Coastguard Worker; RUN: cat %t | grep "define internal i32 @test2"
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Workerdefine internal {} @test() {
9*9880d681SAndroid Build Coastguard Worker  ret {} undef
10*9880d681SAndroid Build Coastguard Worker}
11*9880d681SAndroid Build Coastguard Worker
12*9880d681SAndroid Build Coastguard Workerdefine internal {i32} @test2() {
13*9880d681SAndroid Build Coastguard Worker  ret {i32} undef
14*9880d681SAndroid Build Coastguard Worker}
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Workerdefine void @caller() {
17*9880d681SAndroid Build Coastguard Worker  call {} @test()
18*9880d681SAndroid Build Coastguard Worker  %X = call {i32} @test2()
19*9880d681SAndroid Build Coastguard Worker  %Y = extractvalue {i32} %X, 0
20*9880d681SAndroid Build Coastguard Worker  call void @user(i32 %Y, {i32} %X)
21*9880d681SAndroid Build Coastguard Worker  ret void
22*9880d681SAndroid Build Coastguard Worker}
23*9880d681SAndroid Build Coastguard Worker
24*9880d681SAndroid Build Coastguard Workerdeclare void @user(i32, {i32})
25