[llvm] 61b1446 - [Inliner] Add extra test for callsite noalias metadata (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 31 02:54:57 PDT 2020
Author: Nikita Popov
Date: 2020-10-31T10:54:45+01:00
New Revision: 61b1446a9e45beb77705dce7358b511dd0e8800e
URL: https://github.com/llvm/llvm-project/commit/61b1446a9e45beb77705dce7358b511dd0e8800e
DIFF: https://github.com/llvm/llvm-project/commit/61b1446a9e45beb77705dce7358b511dd0e8800e.diff
LOG: [Inliner] Add extra test for callsite noalias metadata (NFC)
Test the case where the callee does not use noalias metadata itself.
This case is currently handled inconsistently.
Added:
Modified:
llvm/test/Transforms/Inline/noalias-cs.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/Inline/noalias-cs.ll b/llvm/test/Transforms/Inline/noalias-cs.ll
index 8528a391cf95..20fffac24c47 100644
--- a/llvm/test/Transforms/Inline/noalias-cs.ll
+++ b/llvm/test/Transforms/Inline/noalias-cs.ll
@@ -1,9 +1,10 @@
-; RUN: opt -inline -enable-noalias-to-md-conversion -S < %s | FileCheck %s
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -inline -S < %s | FileCheck %s
target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
-; Function Attrs: nounwind uwtable
-define void @foo2(float* nocapture %a, float* nocapture %b, float* nocapture readonly %c) #0 {
+; This callee uses scoped alias metadata internally itself.
+define void @callee_with_metadata(float* nocapture %a, float* nocapture %b, float* nocapture readonly %c) #0 {
entry:
%0 = load float, float* %c, align 4, !noalias !3
%arrayidx.i = getelementptr inbounds float, float* %a, i64 5
@@ -16,33 +17,64 @@ entry:
ret void
}
-define void @foo(float* nocapture %a, float* nocapture %b, float* nocapture readonly %c) #0 {
+; This callee does not make use of scoped alias metadata itself.
+define void @callee_without_metadata(float* nocapture %a, float* nocapture %b, float* nocapture readonly %c) #0 {
entry:
- call void @foo2(float* %a, float* %b, float* %c), !noalias !0
- call void @foo2(float* %b, float* %b, float* %a), !alias.scope !0
+ %0 = load float, float* %c, align 4
+ %arrayidx.i = getelementptr inbounds float, float* %a, i64 5
+ store float %0, float* %arrayidx.i, align 4
+ %arrayidx1.i = getelementptr inbounds float, float* %b, i64 8
+ store float %0, float* %arrayidx1.i, align 4
+ %1 = load float, float* %c, align 4
+ %arrayidx = getelementptr inbounds float, float* %a, i64 7
+ store float %1, float* %arrayidx, align 4
ret void
}
-; CHECK: define void @foo(float* nocapture %a, float* nocapture %b, float* nocapture readonly %c) #0 {
-; CHECK: entry:
-; CHECK: %0 = load float, float* %c, align 4, !noalias !6
-; CHECK: %arrayidx.i.i = getelementptr inbounds float, float* %a, i64 5
-; CHECK: store float %0, float* %arrayidx.i.i, align 4, !alias.scope !12, !noalias !13
-; CHECK: %arrayidx1.i.i = getelementptr inbounds float, float* %b, i64 8
-; CHECK: store float %0, float* %arrayidx1.i.i, align 4, !alias.scope !14, !noalias !15
-; CHECK: %1 = load float, float* %c, align 4, !noalias !16
-; CHECK: %arrayidx.i = getelementptr inbounds float, float* %a, i64 7
-; CHECK: store float %1, float* %arrayidx.i, align 4, !noalias !16
-; CHECK: %2 = load float, float* %a, align 4, !alias.scope !16, !noalias !17
-; CHECK: %arrayidx.i.i1 = getelementptr inbounds float, float* %b, i64 5
-; CHECK: store float %2, float* %arrayidx.i.i1, align 4, !alias.scope !21, !noalias !22
-; CHECK: %arrayidx1.i.i2 = getelementptr inbounds float, float* %b, i64 8
-; CHECK: store float %2, float* %arrayidx1.i.i2, align 4, !alias.scope !23, !noalias !24
-; CHECK: %3 = load float, float* %a, align 4, !alias.scope !16
-; CHECK: %arrayidx.i3 = getelementptr inbounds float, float* %b, i64 7
-; CHECK: store float %3, float* %arrayidx.i3, align 4, !alias.scope !16
-; CHECK: ret void
-; CHECK: }
+define void @caller(float* nocapture %a, float* nocapture %b, float* nocapture readonly %c) #0 {
+; CHECK-LABEL: @caller(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[TMP0:%.*]] = load float, float* [[C:%.*]], align 4, !noalias !6
+; CHECK-NEXT: [[ARRAYIDX_I_I:%.*]] = getelementptr inbounds float, float* [[A:%.*]], i64 5
+; CHECK-NEXT: store float [[TMP0]], float* [[ARRAYIDX_I_I]], align 4, !alias.scope !12, !noalias !13
+; CHECK-NEXT: [[ARRAYIDX1_I_I:%.*]] = getelementptr inbounds float, float* [[B:%.*]], i64 8
+; CHECK-NEXT: store float [[TMP0]], float* [[ARRAYIDX1_I_I]], align 4, !alias.scope !14, !noalias !15
+; CHECK-NEXT: [[TMP1:%.*]] = load float, float* [[C]], align 4, !noalias !16
+; CHECK-NEXT: [[ARRAYIDX_I:%.*]] = getelementptr inbounds float, float* [[A]], i64 7
+; CHECK-NEXT: store float [[TMP1]], float* [[ARRAYIDX_I]], align 4, !noalias !16
+; CHECK-NEXT: [[TMP2:%.*]] = load float, float* [[A]], align 4, !alias.scope !16, !noalias !17
+; CHECK-NEXT: [[ARRAYIDX_I_I7:%.*]] = getelementptr inbounds float, float* [[B]], i64 5
+; CHECK-NEXT: store float [[TMP2]], float* [[ARRAYIDX_I_I7]], align 4, !alias.scope !21, !noalias !22
+; CHECK-NEXT: [[ARRAYIDX1_I_I8:%.*]] = getelementptr inbounds float, float* [[B]], i64 8
+; CHECK-NEXT: store float [[TMP2]], float* [[ARRAYIDX1_I_I8]], align 4, !alias.scope !23, !noalias !24
+; CHECK-NEXT: [[TMP3:%.*]] = load float, float* [[A]], align 4, !alias.scope !16
+; CHECK-NEXT: [[ARRAYIDX_I9:%.*]] = getelementptr inbounds float, float* [[B]], i64 7
+; CHECK-NEXT: store float [[TMP3]], float* [[ARRAYIDX_I9]], align 4, !alias.scope !16
+; CHECK-NEXT: [[TMP4:%.*]] = load float, float* [[C]], align 4
+; CHECK-NEXT: [[ARRAYIDX_I_I4:%.*]] = getelementptr inbounds float, float* [[A]], i64 5
+; CHECK-NEXT: store float [[TMP4]], float* [[ARRAYIDX_I_I4]], align 4
+; CHECK-NEXT: [[ARRAYIDX1_I_I5:%.*]] = getelementptr inbounds float, float* [[B]], i64 8
+; CHECK-NEXT: store float [[TMP4]], float* [[ARRAYIDX1_I_I5]], align 4
+; CHECK-NEXT: [[TMP5:%.*]] = load float, float* [[C]], align 4
+; CHECK-NEXT: [[ARRAYIDX_I6:%.*]] = getelementptr inbounds float, float* [[A]], i64 7
+; CHECK-NEXT: store float [[TMP5]], float* [[ARRAYIDX_I6]], align 4
+; CHECK-NEXT: [[TMP6:%.*]] = load float, float* [[A]], align 4
+; CHECK-NEXT: [[ARRAYIDX_I_I1:%.*]] = getelementptr inbounds float, float* [[B]], i64 5
+; CHECK-NEXT: store float [[TMP6]], float* [[ARRAYIDX_I_I1]], align 4
+; CHECK-NEXT: [[ARRAYIDX1_I_I2:%.*]] = getelementptr inbounds float, float* [[B]], i64 8
+; CHECK-NEXT: store float [[TMP6]], float* [[ARRAYIDX1_I_I2]], align 4
+; CHECK-NEXT: [[TMP7:%.*]] = load float, float* [[A]], align 4
+; CHECK-NEXT: [[ARRAYIDX_I3:%.*]] = getelementptr inbounds float, float* [[B]], i64 7
+; CHECK-NEXT: store float [[TMP7]], float* [[ARRAYIDX_I3]], align 4
+; CHECK-NEXT: ret void
+;
+entry:
+ call void @callee_with_metadata(float* %a, float* %b, float* %c), !noalias !0
+ call void @callee_with_metadata(float* %b, float* %b, float* %a), !alias.scope !0
+ call void @callee_without_metadata(float* %a, float* %b, float* %c), !noalias !0
+ call void @callee_without_metadata(float* %b, float* %b, float* %a), !alias.scope !0
+ ret void
+}
attributes #0 = { nounwind uwtable }
More information about the llvm-commits
mailing list