From c1706f2269ac82cbae2ed538f0857fa6516bcbb4 Mon Sep 17 00:00:00 2001 From: Philip Reames Date: Wed, 24 Feb 2021 09:50:33 -0800 Subject: [PATCH] [tests] precommit tests for an upcoming AA improvement --- llvm/test/Analysis/BasicAA/recphi.ll | 81 ++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/llvm/test/Analysis/BasicAA/recphi.ll b/llvm/test/Analysis/BasicAA/recphi.ll index 7f8bc9d7b668..ac0b27cca650 100644 --- a/llvm/test/Analysis/BasicAA/recphi.ll +++ b/llvm/test/Analysis/BasicAA/recphi.ll @@ -292,4 +292,85 @@ exit: ret void } +; CHECK-LABEL: Function: nested_loop3 +; CHECK: NoAlias: i8* %a, i8* %p.base +; CHECK: NoAlias: i8* %a, i8* %p.outer +; CHECK: NoAlias: i8* %a, i8* %p.outer.next +; CHECK: MayAlias: i8* %a, i8* %p.inner +; CHECK: NoAlias: i8* %a, i8* %p.inner.next +; TODO: %p.inner does not alias %a +define void @nested_loop3(i1 %c, i1 %c2, i8* noalias %p.base) { +entry: + %a = alloca i8 + br label %outer_loop + +outer_loop: + %p.outer = phi i8* [ %p.base, %entry ], [ %p.outer.next, %outer_loop_latch ] + %p.outer.next = getelementptr inbounds i8, i8* %p.outer, i64 10 + br label %inner_loop + +inner_loop: + %p.inner = phi i8* [ %p.outer, %outer_loop ], [ %p.inner.next, %inner_loop ] + %p.inner.next = getelementptr inbounds i8, i8* %p.inner, i64 1 + br i1 %c, label %inner_loop, label %outer_loop_latch + +outer_loop_latch: + br i1 %c2, label %outer_loop, label %exit + +exit: + ret void +} + +; CHECK-LABEL: Function: sibling_loop +; CHECK: NoAlias: i8* %a, i8* %p.base +; CHECK: NoAlias: i8* %a, i8* %p1 +; CHECK: NoAlias: i8* %a, i8* %p1.next +; CHECK: MayAlias: i8* %a, i8* %p2 +; CHECK: NoAlias: i8* %a, i8* %p2.next +; TODO: %p2 does not alias %a +define void @sibling_loop(i1 %c, i1 %c2, i8* noalias %p.base) { +entry: + %a = alloca i8 + br label %loop1 + +loop1: + %p1 = phi i8* [ %p.base, %entry ], [ %p1.next, %loop1 ] + %p1.next = getelementptr inbounds i8, i8* %p1, i64 10 + br i1 %c, label %loop1, label %loop2 + +loop2: + %p2 = phi i8* [ %p1.next, %loop1 ], [ %p2.next, %loop2 ] + %p2.next = getelementptr inbounds i8, i8* %p2, i64 1 + br i1 %c2, label %loop2, label %exit + +exit: + ret void +} + +; CHECK-LABEL: Function: sibling_loop2 +; CHECK: NoAlias: i8* %a, i8* %p.base +; CHECK: NoAlias: i8* %a, i8* %p1 +; CHECK: NoAlias: i8* %a, i8* %p1.next +; CHECK: MayAlias: i8* %a, i8* %p2 +; CHECK: NoAlias: i8* %a, i8* %p2.next +; TODO: %p2 does not alias %a +define void @sibling_loop2(i1 %c, i1 %c2, i8* noalias %p.base) { +entry: + %a = alloca i8 + br label %loop1 + +loop1: + %p1 = phi i8* [ %p.base, %entry ], [ %p1.next, %loop1 ] + %p1.next = getelementptr inbounds i8, i8* %p1, i64 10 + br i1 %c, label %loop1, label %loop2 + +loop2: + %p2 = phi i8* [ %p1, %loop1 ], [ %p2.next, %loop2 ] + %p2.next = getelementptr inbounds i8, i8* %p2, i64 1 + br i1 %c2, label %loop2, label %exit + +exit: + ret void +} + declare i16 @call(i32)