1 ; RUN: opt -passes='print<memoryssa>' -disable-output < %s 2>&1 | FileCheck %s
3 ; TODO: The load's MemoryUse can be defined by liveOnEntry. Since
4 ; %p2 is a loop invariant and the MemoryLoc of load instr and store inst in
5 ; loop block are NoAlias
8 ; CHECK: %val = load i32, ptr %p2
9 define void @gep(ptr %ptr) {
11 %p1 = getelementptr i32, ptr %ptr, i32 1
15 %p2 = getelementptr i32, ptr %p1, i32 1
19 %x = phi i32 [ 0, %tmp ], [ %x.inc, %loop ]
20 %val = load i32, ptr %p2
21 %p3 = getelementptr i32, ptr %p2, i32 1
22 store volatile i32 0, ptr %p3
23 %x.inc = add i32 %x, %val
28 ; CHECK-NEXT: %val = load i32, ptr %p2
29 define void @load_entry_block(ptr %ptr, ptr %addr) {
31 %p1 = load ptr, ptr %ptr
35 %p2 = getelementptr i32, ptr %p1, i32 1
39 %x = phi i32 [ 0, %tmp ], [ %x.inc, %loop ]
40 %val = load i32, ptr %p2
41 %p3 = getelementptr i32, ptr %p2, i32 1
42 store volatile i32 0, ptr %p3
43 %x.inc = add i32 %x, %val