xref: /aosp_15_r20/external/llvm/test/Feature/OperandBundles/pr26510.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: opt -S -globals-aa -functionattrs < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker; RUN: opt -S -O3 < %s | FileCheck %s
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker; Apart from checking for the direct cause of the bug, we also check
5*9880d681SAndroid Build Coastguard Worker; if any problematic aliasing rules have accidentally snuck into -O3.
6*9880d681SAndroid Build Coastguard Worker;
7*9880d681SAndroid Build Coastguard Worker; Since the "abc" operand bundle is not a special operand bundle that
8*9880d681SAndroid Build Coastguard Worker; LLVM knows about, all of the stores and loads in @test below have to
9*9880d681SAndroid Build Coastguard Worker; stay.
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Workerdeclare void @foo() readnone
12*9880d681SAndroid Build Coastguard Worker
13*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: define i8* @test(i8* %p)
14*9880d681SAndroid Build Coastguard Worker; CHECK:   %a = alloca i8*, align 8
15*9880d681SAndroid Build Coastguard Worker; CHECK:   store i8* %p, i8** %a, align 8
16*9880d681SAndroid Build Coastguard Worker; CHECK:   call void @foo() [ "abc"(i8** %a) ]
17*9880d681SAndroid Build Coastguard Worker; CHECK:   %reload = load i8*, i8** %a, align 8
18*9880d681SAndroid Build Coastguard Worker; CHECK:   ret i8* %reload
19*9880d681SAndroid Build Coastguard Worker; CHECK: }
20*9880d681SAndroid Build Coastguard Worker
21*9880d681SAndroid Build Coastguard Workerdefine i8* @test(i8* %p) {
22*9880d681SAndroid Build Coastguard Worker  %a = alloca i8*, align 8
23*9880d681SAndroid Build Coastguard Worker  store i8* %p, i8** %a, align 8
24*9880d681SAndroid Build Coastguard Worker  call void @foo() ["abc" (i8** %a)]
25*9880d681SAndroid Build Coastguard Worker  %reload = load i8*, i8** %a, align 8
26*9880d681SAndroid Build Coastguard Worker  ret i8* %reload
27*9880d681SAndroid Build Coastguard Worker}
28