Author: Nikita Popov Date: 2020-11-22T16:53:06+01:00 New Revision: 221c2b8862b1e507a6e79ca2731c2f839a2fd482
URL: https://github.com/llvm/llvm-project/commit/221c2b8862b1e507a6e79ca2731c2f839a2fd482 DIFF: https://github.com/llvm/llvm-project/commit/221c2b8862b1e507a6e79ca2731c2f839a2fd482.diff LOG: [BasicAA] Add more phi-phi tests (NFC) Test a few more variations: * NoAlias with different strides * MustAlias without loop * MustAlias with same stride * MustAlias base pointers with different stride Added: Modified: llvm/test/Analysis/BasicAA/phi-speculation.ll Removed: ################################################################################ diff --git a/llvm/test/Analysis/BasicAA/phi-speculation.ll b/llvm/test/Analysis/BasicAA/phi-speculation.ll index 198c5340488e..12b2310f4c45 100644 --- a/llvm/test/Analysis/BasicAA/phi-speculation.ll +++ b/llvm/test/Analysis/BasicAA/phi-speculation.ll @@ -92,3 +92,85 @@ while.body: the_exit: ret i32 1 } + +; CHECK-LABEL: test_ diff erent_stride_noalias +; CHECK: NoAlias: i16* %y.base, i8* %x.base +; CHECK: NoAlias: i16* %y, i8* %x +; CHECK: NoAlias: i16* %y.next, i8* %x.next +define void @test_ diff erent_stride_noalias(i1 %c, i8* noalias %x.base, i16* noalias %y.base) { +entry: + br label %loop + +loop: + %x = phi i8* [ %x.base, %entry ], [ %x.next, %loop ] + %y = phi i16* [ %y.base, %entry ], [ %y.next, %loop ] + %x.next = getelementptr i8, i8* %x, i64 1 + %y.next = getelementptr i16, i16* %y, i64 1 + br i1 %c, label %loop, label %exit + +exit: + ret void +} + +; CHECK-LABEL: test_no_loop_mustalias +; CHECK: MayAlias: i16* %z16, i8* %z8 +; TODO: (z8, z16) could be MustAlias +define void @test_no_loop_mustalias(i1 %c, i8* noalias %x8, i8* noalias %y8) { + br i1 %c, label %if, label %else + +if: + %x16 = bitcast i8* %x8 to i16* + br label %end + +else: + %y16 = bitcast i8* %y8 to i16* + br label %end + +end: + %z8 = phi i8* [ %x8, %if ], [ %y8, %else ] + %z16 = phi i16* [ %x16, %if ], [ %y16, %else ] + ret void +} + +; CHECK-LABEL: test_same_stride_mustalias +; CHECK: MustAlias: i4* %y.base, i8* %x.base +; CHECK: MayAlias: i4* %y, i8* %x +; CHECK: MayAlias: i4* %y.next, i8* %x.next +; TODO: (x, y) could be MustAlias +define void @test_same_stride_mustalias(i1 %c, i8* noalias %x.base) { +entry: + %y.base = bitcast i8* %x.base to i4* + br label %loop + +loop: + %x = phi i8* [ %x.base, %entry ], [ %x.next, %loop ] + %y = phi i4* [ %y.base, %entry ], [ %y.next, %loop ] + %x.next = getelementptr i8, i8* %x, i64 1 + %y.next = getelementptr i4, i4* %y, i64 1 + br i1 %c, label %loop, label %exit + +exit: + ret void +} + +; CHECK-LABEL: test_ diff erent_stride_mustalias +; CHECK: MustAlias: i16* %y.base, i8* %x.base +; CHECK: MayAlias: i16* %y, i8* %x +; CHECK: MayAlias: i16* %y.next, i8* %x.next +; Even though the base pointers MustAlias, the diff erent strides don't preserve +; this property across iterations. +define void @test_ diff erent_stride_mustalias(i1 %c, i8* noalias %x.base) { +entry: + %y.base = bitcast i8* %x.base to i16* + br label %loop + +loop: + %x = phi i8* [ %x.base, %entry ], [ %x.next, %loop ] + %y = phi i16* [ %y.base, %entry ], [ %y.next, %loop ] + %x.next = getelementptr i8, i8* %x, i64 1 + %y.next = getelementptr i16, i16* %y, i64 1 + br i1 %c, label %loop, label %exit + +exit: + ret void +} _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits