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