[llvm] 0830103 - [Attributor] Ensure to use the proper liveness AA

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 22 12:41:11 PDT 2022


asan is still broken https://lab.llvm.org/buildbot/#/builders/5/builds/25088

On Tue, 21 Jun 2022 at 19:31, Johannes Doerfert via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

>
> Author: Johannes Doerfert
> Date: 2022-06-21T21:28:26-05:00
> New Revision: 083010312aa4a0ba0cd5299bd3b039af8fb6d58f
>
> URL:
> https://github.com/llvm/llvm-project/commit/083010312aa4a0ba0cd5299bd3b039af8fb6d58f
> DIFF:
> https://github.com/llvm/llvm-project/commit/083010312aa4a0ba0cd5299bd3b039af8fb6d58f.diff
>
> LOG: [Attributor] Ensure to use the proper liveness AA
>
> When determining liveness via Attributor::isAssumedDead(...) we might
> end up without a liveness AA or with one pointing into another function.
> Neither is helpful and we will avoid both from now on.
>
> Reapplied after fixing the ASAN error which caused the revert:
>
> https://github.com/llvm/llvm-project/commit/db68a25ca90e0da46c9c33b027fa83260073bd28
>
> Added:
>
>
> Modified:
>     llvm/include/llvm/Transforms/IPO/Attributor.h
>     llvm/lib/Transforms/IPO/Attributor.cpp
>     llvm/test/Transforms/Attributor/IPConstantProp/return-constant.ll
>     llvm/test/Transforms/Attributor/IPConstantProp/return-constants.ll
>     llvm/test/Transforms/Attributor/align.ll
>     llvm/test/Transforms/Attributor/read_write_returned_arguments_scc.ll
>
> Removed:
>
>
>
>
> ################################################################################
> diff  --git a/llvm/include/llvm/Transforms/IPO/Attributor.h
> b/llvm/include/llvm/Transforms/IPO/Attributor.h
> index 6aa19b00e0f6b..123cfd5e1968e 100644
> --- a/llvm/include/llvm/Transforms/IPO/Attributor.h
> +++ b/llvm/include/llvm/Transforms/IPO/Attributor.h
> @@ -1424,9 +1424,10 @@ struct Attributor {
>        return AA;
>      }
>
> -    // If this is queried in the manifest stage, we force the AA to
> indicate
> -    // pessimistic fixpoint immediately.
> -    if (Phase == AttributorPhase::MANIFEST) {
> +    // If this is queried in the manifest or cleanup stage, we force the
> AA to
> +    // indicate pessimistic fixpoint immediately.
> +    if (Phase == AttributorPhase::MANIFEST ||
> +        Phase == AttributorPhase::CLEANUP) {
>        AA.getState().indicatePessimisticFixpoint();
>        return AA;
>      }
>
> diff  --git a/llvm/lib/Transforms/IPO/Attributor.cpp
> b/llvm/lib/Transforms/IPO/Attributor.cpp
> index 221e688d90660..dbb1e539af1a4 100644
> --- a/llvm/lib/Transforms/IPO/Attributor.cpp
> +++ b/llvm/lib/Transforms/IPO/Attributor.cpp
> @@ -1188,16 +1188,14 @@ bool Attributor::isAssumedDead(const Instruction
> &I,
>    if (ManifestAddedBlocks.contains(I.getParent()))
>      return false;
>
> -  if (!FnLivenessAA)
> -    FnLivenessAA =
> -        lookupAAFor<AAIsDead>(IRPosition::function(*I.getFunction(),
> CBCtx),
> -                              QueryingAA, DepClassTy::NONE);
> +  if (!FnLivenessAA || FnLivenessAA->getAnchorScope() != I.getFunction())
> +    FnLivenessAA = &getOrCreateAAFor<AAIsDead>(
> +        IRPosition::function(*I.getFunction(), CBCtx), QueryingAA,
> +        DepClassTy::NONE);
>
>    // If we have a context instruction and a liveness AA we use it.
> -  if (FnLivenessAA &&
> -      FnLivenessAA->getIRPosition().getAnchorScope() == I.getFunction() &&
> -      (CheckBBLivenessOnly ? FnLivenessAA->isAssumedDead(I.getParent())
> -                           : FnLivenessAA->isAssumedDead(&I))) {
> +  if (CheckBBLivenessOnly ? FnLivenessAA->isAssumedDead(I.getParent())
> +                          : FnLivenessAA->isAssumedDead(&I)) {
>      if (QueryingAA)
>        recordDependence(*FnLivenessAA, *QueryingAA, DepClass);
>      if (!FnLivenessAA->isKnownDead(&I))
> @@ -1268,9 +1266,9 @@ bool Attributor::isAssumedDead(const BasicBlock &BB,
>                                 const AbstractAttribute *QueryingAA,
>                                 const AAIsDead *FnLivenessAA,
>                                 DepClassTy DepClass) {
> -  if (!FnLivenessAA)
> -    FnLivenessAA =
> lookupAAFor<AAIsDead>(IRPosition::function(*BB.getParent()),
> -                                         QueryingAA, DepClassTy::NONE);
> +  if (!FnLivenessAA || FnLivenessAA->getAnchorScope() != BB.getParent())
> +    FnLivenessAA = &getOrCreateAAFor<AAIsDead>(
> +        IRPosition::function(*BB.getParent()), QueryingAA,
> DepClassTy::NONE);
>    if (FnLivenessAA->isAssumedDead(&BB)) {
>      if (QueryingAA)
>        recordDependence(*FnLivenessAA, *QueryingAA, DepClass);
>
> diff  --git
> a/llvm/test/Transforms/Attributor/IPConstantProp/return-constant.ll
> b/llvm/test/Transforms/Attributor/IPConstantProp/return-constant.ll
> index 5a51fa46aaa66..b491b99b1c0d2 100644
> --- a/llvm/test/Transforms/Attributor/IPConstantProp/return-constant.ll
> +++ b/llvm/test/Transforms/Attributor/IPConstantProp/return-constant.ll
> @@ -1,6 +1,6 @@
>  ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
> UTC_ARGS: --function-signature --check-attributes --check-globals
> -; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal
> -attributor-max-iterations-verify -attributor-annotate-decl-cs
> -attributor-max-iterations=2 -S < %s | FileCheck %s
> --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
> -; RUN: opt -aa-pipeline=basic-aa -passes=attributor
> -attributor-manifest-internal  -attributor-max-iterations-verify
> -attributor-annotate-decl-cs -attributor-max-iterations=2 -S < %s |
> FileCheck %s
> --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
> +; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal
> -attributor-max-iterations-verify -attributor-annotate-decl-cs
> -attributor-max-iterations=4 -S < %s | FileCheck %s
> --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
> +; RUN: opt -aa-pipeline=basic-aa -passes=attributor
> -attributor-manifest-internal  -attributor-max-iterations-verify
> -attributor-annotate-decl-cs -attributor-max-iterations=4 -S < %s |
> FileCheck %s
> --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
>  ; RUN: opt -attributor-cgscc -enable-new-pm=0
> -attributor-manifest-internal  -attributor-annotate-decl-cs -S < %s |
> FileCheck %s
> --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM
>  ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc
> -attributor-manifest-internal  -attributor-annotate-decl-cs -S < %s |
> FileCheck %s
> --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM
>
>
> diff  --git
> a/llvm/test/Transforms/Attributor/IPConstantProp/return-constants.ll
> b/llvm/test/Transforms/Attributor/IPConstantProp/return-constants.ll
> index 84608789c0f53..0ad55e613a473 100644
> --- a/llvm/test/Transforms/Attributor/IPConstantProp/return-constants.ll
> +++ b/llvm/test/Transforms/Attributor/IPConstantProp/return-constants.ll
> @@ -1,6 +1,6 @@
>  ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
> UTC_ARGS: --function-signature --check-attributes --check-globals
> -; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal
> -attributor-max-iterations-verify -attributor-annotate-decl-cs
> -attributor-max-iterations=2 -S < %s | FileCheck %s
> --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
> -; RUN: opt -aa-pipeline=basic-aa -passes=attributor
> -attributor-manifest-internal  -attributor-max-iterations-verify
> -attributor-annotate-decl-cs -attributor-max-iterations=2 -S < %s |
> FileCheck %s
> --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
> +; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal
> -attributor-max-iterations-verify -attributor-annotate-decl-cs
> -attributor-max-iterations=8 -S < %s | FileCheck %s
> --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
> +; RUN: opt -aa-pipeline=basic-aa -passes=attributor
> -attributor-manifest-internal  -attributor-max-iterations-verify
> -attributor-annotate-decl-cs -attributor-max-iterations=8 -S < %s |
> FileCheck %s
> --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
>  ; RUN: opt -attributor-cgscc -enable-new-pm=0
> -attributor-manifest-internal  -attributor-annotate-decl-cs -S < %s |
> FileCheck %s
> --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM
>  ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc
> -attributor-manifest-internal  -attributor-annotate-decl-cs -S < %s |
> FileCheck %s
> --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM
>
>
> diff  --git a/llvm/test/Transforms/Attributor/align.ll
> b/llvm/test/Transforms/Attributor/align.ll
> index 3524f1da4719c..08b020c5a98ac 100644
> --- a/llvm/test/Transforms/Attributor/align.ll
> +++ b/llvm/test/Transforms/Attributor/align.ll
> @@ -138,12 +138,12 @@ define i32* @test6_2() #0 {
>  define internal i8* @f1(i8* readnone %0) local_unnamed_addr #0 {
>  ; IS__CGSCC____: Function Attrs: nofree noinline norecurse nosync
> nounwind readnone willreturn uwtable
>  ; IS__CGSCC____-LABEL: define {{[^@]+}}@f1
> -; IS__CGSCC____-SAME: (i8* noalias nofree noundef nonnull readnone
> returned align 8 dereferenceable(1) "no-capture-maybe-returned"
> [[TMP0:%.*]]) local_unnamed_addr #[[ATTR0]] {
> -; IS__CGSCC____-NEXT:    br label [[TMP3:%.*]]
> -; IS__CGSCC____:       2:
> +; IS__CGSCC____-SAME: () local_unnamed_addr #[[ATTR0]] {
> +; IS__CGSCC____-NEXT:    br label [[TMP2:%.*]]
> +; IS__CGSCC____:       1:
>  ; IS__CGSCC____-NEXT:    unreachable
> -; IS__CGSCC____:       3:
> -; IS__CGSCC____-NEXT:    ret i8* [[TMP0]]
> +; IS__CGSCC____:       2:
> +; IS__CGSCC____-NEXT:    ret i8* @a1
>  ;
>    %2 = icmp eq i8* %0, null
>    br i1 %2, label %3, label %5
> @@ -163,32 +163,24 @@ define internal i8* @f2(i8* readnone %0)
> local_unnamed_addr #0 {
>  ; IS__CGSCC_OPM: Function Attrs: noinline nounwind uwtable
>  ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@f2
>  ; IS__CGSCC_OPM-SAME: (i8* readnone [[TMP0:%.*]]) local_unnamed_addr
> #[[ATTR2:[0-9]+]] {
> -; IS__CGSCC_OPM-NEXT:    [[TMP2:%.*]] = icmp eq i8* [[TMP0]], null
> -; IS__CGSCC_OPM-NEXT:    br i1 [[TMP2]], label [[TMP5:%.*]], label
> [[TMP3:%.*]]
> +; IS__CGSCC_OPM-NEXT:    unreachable
> +; IS__CGSCC_OPM:       2:
> +; IS__CGSCC_OPM-NEXT:    unreachable
>  ; IS__CGSCC_OPM:       3:
> -; IS__CGSCC_OPM-NEXT:    [[TMP4:%.*]] = tail call i8* @f1(i8* noalias
> noundef nonnull readnone align 4294967296 dereferenceable(4294967295)
> [[TMP0]])
> -; IS__CGSCC_OPM-NEXT:    br label [[TMP7:%.*]]
> -; IS__CGSCC_OPM:       5:
> -; IS__CGSCC_OPM-NEXT:    [[TMP6:%.*]] = tail call i8* @f3(i8* nonnull @a2)
> -; IS__CGSCC_OPM-NEXT:    br label [[TMP7]]
> -; IS__CGSCC_OPM:       7:
> -; IS__CGSCC_OPM-NEXT:    [[TMP8:%.*]] = phi i8* [ [[TMP4]], [[TMP3]] ], [
> [[TMP6]], [[TMP5]] ]
> -; IS__CGSCC_OPM-NEXT:    ret i8* [[TMP8]]
> +; IS__CGSCC_OPM-NEXT:    unreachable
> +; IS__CGSCC_OPM:       4:
> +; IS__CGSCC_OPM-NEXT:    unreachable
>  ;
>  ; IS__CGSCC_NPM: Function Attrs: noinline nounwind uwtable
>  ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@f2
>  ; IS__CGSCC_NPM-SAME: (i8* readnone [[TMP0:%.*]]) local_unnamed_addr
> #[[ATTR1:[0-9]+]] {
> -; IS__CGSCC_NPM-NEXT:    [[TMP2:%.*]] = icmp eq i8* [[TMP0]], null
> -; IS__CGSCC_NPM-NEXT:    br i1 [[TMP2]], label [[TMP5:%.*]], label
> [[TMP3:%.*]]
> +; IS__CGSCC_NPM-NEXT:    unreachable
> +; IS__CGSCC_NPM:       2:
> +; IS__CGSCC_NPM-NEXT:    unreachable
>  ; IS__CGSCC_NPM:       3:
> -; IS__CGSCC_NPM-NEXT:    [[TMP4:%.*]] = tail call i8* @f1(i8* noalias
> noundef nonnull readnone align 4294967296 dereferenceable(4294967295)
> [[TMP0]])
> -; IS__CGSCC_NPM-NEXT:    br label [[TMP7:%.*]]
> -; IS__CGSCC_NPM:       5:
> -; IS__CGSCC_NPM-NEXT:    [[TMP6:%.*]] = tail call i8* @f3()
> -; IS__CGSCC_NPM-NEXT:    br label [[TMP7]]
> -; IS__CGSCC_NPM:       7:
> -; IS__CGSCC_NPM-NEXT:    [[TMP8:%.*]] = phi i8* [ [[TMP4]], [[TMP3]] ], [
> [[TMP6]], [[TMP5]] ]
> -; IS__CGSCC_NPM-NEXT:    ret i8* [[TMP8]]
> +; IS__CGSCC_NPM-NEXT:    unreachable
> +; IS__CGSCC_NPM:       4:
> +; IS__CGSCC_NPM-NEXT:    unreachable
>  ;
>    %2 = icmp eq i8* %0, null
>    br i1 %2, label %5, label %3
> @@ -212,23 +204,20 @@ define internal i8* @f3(i8* readnone %0)
> local_unnamed_addr #0 {
>  ; IS__CGSCC_OPM: Function Attrs: noinline nounwind uwtable
>  ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@f3
>  ; IS__CGSCC_OPM-SAME: (i8* readnone [[TMP0:%.*]]) local_unnamed_addr
> #[[ATTR2]] {
> -; IS__CGSCC_OPM-NEXT:    [[TMP2:%.*]] = icmp eq i8* [[TMP0]], null
> -; IS__CGSCC_OPM-NEXT:    br i1 [[TMP2]], label [[TMP3:%.*]], label
> [[TMP5:%.*]]
> +; IS__CGSCC_OPM-NEXT:    unreachable
> +; IS__CGSCC_OPM:       2:
> +; IS__CGSCC_OPM-NEXT:    unreachable
>  ; IS__CGSCC_OPM:       3:
> -; IS__CGSCC_OPM-NEXT:    [[TMP4:%.*]] = tail call i8* @f1(i8* noalias
> noundef nonnull readnone align 16 dereferenceable(1) @a2)
> -; IS__CGSCC_OPM-NEXT:    br label [[TMP5]]
> -; IS__CGSCC_OPM:       5:
> -; IS__CGSCC_OPM-NEXT:    [[TMP6:%.*]] = phi i8* [ [[TMP4]], [[TMP3]] ], [
> @a1, [[TMP1:%.*]] ]
> -; IS__CGSCC_OPM-NEXT:    ret i8* [[TMP6]]
> +; IS__CGSCC_OPM-NEXT:    unreachable
>  ;
> -; IS__CGSCC_NPM: Function Attrs: nofree noinline norecurse nosync
> nounwind readnone willreturn uwtable
> +; IS__CGSCC_NPM: Function Attrs: noinline nounwind uwtable
>  ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@f3
> -; IS__CGSCC_NPM-SAME: () local_unnamed_addr #[[ATTR0]] {
> -; IS__CGSCC_NPM-NEXT:    br label [[TMP2:%.*]]
> -; IS__CGSCC_NPM:       1:
> +; IS__CGSCC_NPM-SAME: (i8* readnone [[TMP0:%.*]]) local_unnamed_addr
> #[[ATTR1]] {
>  ; IS__CGSCC_NPM-NEXT:    unreachable
>  ; IS__CGSCC_NPM:       2:
> -; IS__CGSCC_NPM-NEXT:    ret i8* @a1
> +; IS__CGSCC_NPM-NEXT:    unreachable
> +; IS__CGSCC_NPM:       3:
> +; IS__CGSCC_NPM-NEXT:    unreachable
>  ;
>    %2 = icmp eq i8* %0, null
>    br i1 %2, label %3, label %5
> @@ -253,12 +242,14 @@ define align 4 i8* @test7() #0 {
>  ; IS__CGSCC_OPM: Function Attrs: nofree noinline nosync nounwind readnone
> willreturn uwtable
>  ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@test7
>  ; IS__CGSCC_OPM-SAME: () #[[ATTR1]] {
> -; IS__CGSCC_OPM-NEXT:    ret i8* @a1
> +; IS__CGSCC_OPM-NEXT:    [[C:%.*]] = tail call noundef nonnull align 8
> dereferenceable(1) i8* @f1() #[[ATTR13:[0-9]+]]
> +; IS__CGSCC_OPM-NEXT:    ret i8* [[C]]
>  ;
>  ; IS__CGSCC_NPM: Function Attrs: nofree noinline nosync nounwind readnone
> willreturn uwtable
>  ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@test7
>  ; IS__CGSCC_NPM-SAME: () #[[ATTR2:[0-9]+]] {
> -; IS__CGSCC_NPM-NEXT:    ret i8* @a1
> +; IS__CGSCC_NPM-NEXT:    [[C:%.*]] = tail call noundef nonnull align 8
> dereferenceable(1) i8* @f1() #[[ATTR13:[0-9]+]]
> +; IS__CGSCC_NPM-NEXT:    ret i8* [[C]]
>  ;
>    %c = tail call i8* @f1(i8* align 8 dereferenceable(1) @a1)
>    ret i8* %c
> @@ -267,23 +258,14 @@ define align 4 i8* @test7() #0 {
>  ; TEST 7b
>  ; Function Attrs: nounwind readnone ssp uwtable
>  define internal i8* @f1b(i8* readnone %0) local_unnamed_addr #0 {
> -; IS__CGSCC_OPM: Function Attrs: nofree noinline norecurse nosync
> nounwind readnone willreturn uwtable
> -; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@f1b
> -; IS__CGSCC_OPM-SAME: (i8* noalias nocapture nofree nonnull readnone
> align 8 dereferenceable(1) [[TMP0:%.*]]) local_unnamed_addr #[[ATTR0]] {
> -; IS__CGSCC_OPM-NEXT:    br label [[TMP3:%.*]]
> -; IS__CGSCC_OPM:       2:
> -; IS__CGSCC_OPM-NEXT:    unreachable
> -; IS__CGSCC_OPM:       3:
> -; IS__CGSCC_OPM-NEXT:    ret i8* undef
> -;
> -; IS__CGSCC_NPM: Function Attrs: nofree noinline norecurse nosync
> nounwind readnone willreturn uwtable
> -; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@f1b
> -; IS__CGSCC_NPM-SAME: () local_unnamed_addr #[[ATTR0]] {
> -; IS__CGSCC_NPM-NEXT:    br label [[TMP2:%.*]]
> -; IS__CGSCC_NPM:       1:
> -; IS__CGSCC_NPM-NEXT:    unreachable
> -; IS__CGSCC_NPM:       2:
> -; IS__CGSCC_NPM-NEXT:    ret i8* undef
> +; IS__CGSCC____: Function Attrs: nofree noinline norecurse nosync
> nounwind readnone willreturn uwtable
> +; IS__CGSCC____-LABEL: define {{[^@]+}}@f1b
> +; IS__CGSCC____-SAME: () local_unnamed_addr #[[ATTR0]] {
> +; IS__CGSCC____-NEXT:    br label [[TMP2:%.*]]
> +; IS__CGSCC____:       1:
> +; IS__CGSCC____-NEXT:    unreachable
> +; IS__CGSCC____:       2:
> +; IS__CGSCC____-NEXT:    ret i8* undef
>  ;
>    %2 = icmp eq i8* %0, null
>    br i1 %2, label %3, label %5
> @@ -305,30 +287,24 @@ define internal i8* @f2b(i8* readnone %0)
> local_unnamed_addr #0 {
>  ; IS__CGSCC_OPM: Function Attrs: noinline nounwind uwtable
>  ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@f2b
>  ; IS__CGSCC_OPM-SAME: (i8* readnone [[TMP0:%.*]]) local_unnamed_addr
> #[[ATTR2]] {
> -; IS__CGSCC_OPM-NEXT:    [[TMP2:%.*]] = icmp eq i8* [[TMP0]], null
> -; IS__CGSCC_OPM-NEXT:    br i1 [[TMP2]], label [[TMP4:%.*]], label
> [[TMP3:%.*]]
> +; IS__CGSCC_OPM-NEXT:    unreachable
> +; IS__CGSCC_OPM:       2:
> +; IS__CGSCC_OPM-NEXT:    unreachable
>  ; IS__CGSCC_OPM:       3:
> -; IS__CGSCC_OPM-NEXT:    br label [[TMP6:%.*]]
> +; IS__CGSCC_OPM-NEXT:    unreachable
>  ; IS__CGSCC_OPM:       4:
> -; IS__CGSCC_OPM-NEXT:    [[TMP5:%.*]] = tail call i8* @f3b(i8* nonnull
> @a2)
> -; IS__CGSCC_OPM-NEXT:    br label [[TMP6]]
> -; IS__CGSCC_OPM:       6:
> -; IS__CGSCC_OPM-NEXT:    [[TMP7:%.*]] = phi i8* [ undef, [[TMP3]] ], [
> [[TMP5]], [[TMP4]] ]
> -; IS__CGSCC_OPM-NEXT:    ret i8* [[TMP7]]
> +; IS__CGSCC_OPM-NEXT:    unreachable
>  ;
>  ; IS__CGSCC_NPM: Function Attrs: noinline nounwind uwtable
>  ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@f2b
>  ; IS__CGSCC_NPM-SAME: (i8* readnone [[TMP0:%.*]]) local_unnamed_addr
> #[[ATTR1]] {
> -; IS__CGSCC_NPM-NEXT:    [[TMP2:%.*]] = icmp eq i8* [[TMP0]], null
> -; IS__CGSCC_NPM-NEXT:    br i1 [[TMP2]], label [[TMP4:%.*]], label
> [[TMP3:%.*]]
> +; IS__CGSCC_NPM-NEXT:    unreachable
> +; IS__CGSCC_NPM:       2:
> +; IS__CGSCC_NPM-NEXT:    unreachable
>  ; IS__CGSCC_NPM:       3:
> -; IS__CGSCC_NPM-NEXT:    br label [[TMP6:%.*]]
> +; IS__CGSCC_NPM-NEXT:    unreachable
>  ; IS__CGSCC_NPM:       4:
> -; IS__CGSCC_NPM-NEXT:    [[TMP5:%.*]] = tail call i8* @f3b()
> -; IS__CGSCC_NPM-NEXT:    br label [[TMP6]]
> -; IS__CGSCC_NPM:       6:
> -; IS__CGSCC_NPM-NEXT:    [[TMP7:%.*]] = phi i8* [ undef, [[TMP3]] ], [
> [[TMP5]], [[TMP4]] ]
> -; IS__CGSCC_NPM-NEXT:    ret i8* [[TMP7]]
> +; IS__CGSCC_NPM-NEXT:    unreachable
>  ;
>    %2 = icmp eq i8* %0, null
>    br i1 %2, label %5, label %3
> @@ -353,22 +329,20 @@ define internal i8* @f3b(i8* readnone %0)
> local_unnamed_addr #0 {
>  ; IS__CGSCC_OPM: Function Attrs: noinline nounwind uwtable
>  ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@f3b
>  ; IS__CGSCC_OPM-SAME: (i8* readnone [[TMP0:%.*]]) local_unnamed_addr
> #[[ATTR2]] {
> -; IS__CGSCC_OPM-NEXT:    [[TMP2:%.*]] = icmp eq i8* [[TMP0]], null
> -; IS__CGSCC_OPM-NEXT:    br i1 [[TMP2]], label [[TMP3:%.*]], label
> [[TMP4:%.*]]
> +; IS__CGSCC_OPM-NEXT:    unreachable
> +; IS__CGSCC_OPM:       2:
> +; IS__CGSCC_OPM-NEXT:    unreachable
>  ; IS__CGSCC_OPM:       3:
> -; IS__CGSCC_OPM-NEXT:    br label [[TMP4]]
> -; IS__CGSCC_OPM:       4:
> -; IS__CGSCC_OPM-NEXT:    [[TMP5:%.*]] = phi i8* [ @a2, [[TMP3]] ], [ @a1,
> [[TMP1:%.*]] ]
> -; IS__CGSCC_OPM-NEXT:    ret i8* [[TMP5]]
> +; IS__CGSCC_OPM-NEXT:    unreachable
>  ;
> -; IS__CGSCC_NPM: Function Attrs: nofree noinline norecurse nosync
> nounwind readnone willreturn uwtable
> +; IS__CGSCC_NPM: Function Attrs: noinline nounwind uwtable
>  ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@f3b
> -; IS__CGSCC_NPM-SAME: () local_unnamed_addr #[[ATTR0]] {
> -; IS__CGSCC_NPM-NEXT:    br label [[TMP2:%.*]]
> -; IS__CGSCC_NPM:       1:
> +; IS__CGSCC_NPM-SAME: (i8* readnone [[TMP0:%.*]]) local_unnamed_addr
> #[[ATTR1]] {
>  ; IS__CGSCC_NPM-NEXT:    unreachable
>  ; IS__CGSCC_NPM:       2:
> -; IS__CGSCC_NPM-NEXT:    ret i8* @a1
> +; IS__CGSCC_NPM-NEXT:    unreachable
> +; IS__CGSCC_NPM:       3:
> +; IS__CGSCC_NPM-NEXT:    unreachable
>  ;
>    %2 = icmp eq i8* %0, null
>    br i1 %2, label %3, label %5
> @@ -1042,7 +1016,7 @@ define i32 @musttail_caller_1(i32* %p) {
>  ; IS__CGSCC____-NEXT:    [[C:%.*]] = load i1, i1* @cnd, align 1
>  ; IS__CGSCC____-NEXT:    br i1 [[C]], label [[MT:%.*]], label [[EXIT:%.*]]
>  ; IS__CGSCC____:       mt:
> -; IS__CGSCC____-NEXT:    [[V:%.*]] = musttail call i32
> @musttail_callee_1(i32* nocapture nofree noundef nonnull readonly
> dereferenceable(4) [[P]]) #[[ATTR13:[0-9]+]]
> +; IS__CGSCC____-NEXT:    [[V:%.*]] = musttail call i32
> @musttail_callee_1(i32* nocapture nofree noundef nonnull readonly
> dereferenceable(4) [[P]]) #[[ATTR14:[0-9]+]]
>  ; IS__CGSCC____-NEXT:    ret i32 [[V]]
>  ; IS__CGSCC____:       exit:
>  ; IS__CGSCC____-NEXT:    ret i32 0
> @@ -1180,7 +1154,7 @@ define i8* @aligned_8_return_caller(i8* align(16)
> %a, i1 %c1, i1 %c2) {
>  ; IS__CGSCC____: Function Attrs: nofree nosync nounwind readnone
> willreturn
>  ; IS__CGSCC____-LABEL: define {{[^@]+}}@aligned_8_return_caller
>  ; IS__CGSCC____-SAME: (i8* nofree readnone align 16 [[A:%.*]], i1
> [[C1:%.*]], i1 [[C2:%.*]]) #[[ATTR12:[0-9]+]] {
> -; IS__CGSCC____-NEXT:    [[R:%.*]] = call align 8 i8*
> @aligned_8_return(i8* noalias nofree readnone align 16 [[A]], i1 [[C1]], i1
> [[C2]]) #[[ATTR14:[0-9]+]]
> +; IS__CGSCC____-NEXT:    [[R:%.*]] = call align 8 i8*
> @aligned_8_return(i8* noalias nofree readnone align 16 [[A]], i1 [[C1]], i1
> [[C2]]) #[[ATTR13:[0-9]+]]
>  ; IS__CGSCC____-NEXT:    ret i8* [[R]]
>  ;
>    %r = call i8* @aligned_8_return(i8* %a, i1 %c1, i1 %c2)
> @@ -1218,8 +1192,8 @@ attributes #2 = { null_pointer_is_valid }
>  ; IS__CGSCC_OPM: attributes #[[ATTR10]] = { nofree norecurse nosync
> nounwind readnone willreturn }
>  ; IS__CGSCC_OPM: attributes #[[ATTR11]] = { nofree nosync nounwind
> readonly willreturn }
>  ; IS__CGSCC_OPM: attributes #[[ATTR12]] = { nofree nosync nounwind
> readnone willreturn }
> -; IS__CGSCC_OPM: attributes #[[ATTR13]] = { readonly willreturn }
> -; IS__CGSCC_OPM: attributes #[[ATTR14]] = { readnone willreturn }
> +; IS__CGSCC_OPM: attributes #[[ATTR13]] = { readnone willreturn }
> +; IS__CGSCC_OPM: attributes #[[ATTR14]] = { readonly willreturn }
>  ;.
>  ; IS__CGSCC_NPM: attributes #[[ATTR0]] = { nofree noinline norecurse
> nosync nounwind readnone willreturn uwtable }
>  ; IS__CGSCC_NPM: attributes #[[ATTR1]] = { noinline nounwind uwtable }
> @@ -1234,6 +1208,6 @@ attributes #2 = { null_pointer_is_valid }
>  ; IS__CGSCC_NPM: attributes #[[ATTR10]] = { nofree norecurse nosync
> nounwind readnone willreturn }
>  ; IS__CGSCC_NPM: attributes #[[ATTR11]] = { nofree nosync nounwind
> readonly willreturn }
>  ; IS__CGSCC_NPM: attributes #[[ATTR12]] = { nofree nosync nounwind
> readnone willreturn }
> -; IS__CGSCC_NPM: attributes #[[ATTR13]] = { readonly willreturn }
> -; IS__CGSCC_NPM: attributes #[[ATTR14]] = { readnone willreturn }
> +; IS__CGSCC_NPM: attributes #[[ATTR13]] = { readnone willreturn }
> +; IS__CGSCC_NPM: attributes #[[ATTR14]] = { readonly willreturn }
>  ;.
>
> diff  --git
> a/llvm/test/Transforms/Attributor/read_write_returned_arguments_scc.ll
> b/llvm/test/Transforms/Attributor/read_write_returned_arguments_scc.ll
> index 1070923a6ea37..3f125270cdd7a 100644
> --- a/llvm/test/Transforms/Attributor/read_write_returned_arguments_scc.ll
> +++ b/llvm/test/Transforms/Attributor/read_write_returned_arguments_scc.ll
> @@ -1,6 +1,6 @@
>  ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
> UTC_ARGS: --function-signature --check-attributes --check-globals
> -; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal
> -attributor-max-iterations-verify -attributor-annotate-decl-cs
> -attributor-max-iterations=8 -S < %s | FileCheck %s
> --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
> -; RUN: opt -aa-pipeline=basic-aa -passes=attributor
> -attributor-manifest-internal  -attributor-max-iterations-verify
> -attributor-annotate-decl-cs -attributor-max-iterations=8 -S < %s |
> FileCheck %s
> --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
> +; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal
> -attributor-max-iterations-verify -attributor-annotate-decl-cs
> -attributor-max-iterations=10 -S < %s | FileCheck %s
> --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
> +; RUN: opt -aa-pipeline=basic-aa -passes=attributor
> -attributor-manifest-internal  -attributor-max-iterations-verify
> -attributor-annotate-decl-cs -attributor-max-iterations=10 -S < %s |
> FileCheck %s
> --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
>  ; RUN: opt -attributor-cgscc -enable-new-pm=0
> -attributor-manifest-internal  -attributor-annotate-decl-cs -S < %s |
> FileCheck %s
> --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM
>  ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc
> -attributor-manifest-internal  -attributor-annotate-decl-cs -S < %s |
> FileCheck %s
> --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM
>
> @@ -41,7 +41,7 @@ define i32* @external_ret2_nrw(i32* %n0, i32* %r0, i32*
> %w0) {
>  ; IS__TUNIT____-NEXT:  entry:
>  ; IS__TUNIT____-NEXT:    [[CALL:%.*]] = call i32* @internal_ret0_nw(i32*
> nofree [[N0]], i32* nofree [[W0]]) #[[ATTR3:[0-9]+]]
>  ; IS__TUNIT____-NEXT:    [[CALL1:%.*]] = call i32*
> @internal_ret1_rrw(i32* nofree align 4 [[R0]], i32* nofree align 4 [[R0]],
> i32* nofree [[W0]]) #[[ATTR3]]
> -; IS__TUNIT____-NEXT:    [[CALL2:%.*]] = call i32*
> @external_sink_ret2_nrw(i32* nofree [[N0]], i32* nocapture nofree readonly
> [[R0]], i32* nofree writeonly "no-capture-maybe-returned" [[W0]]) #[[ATTR3]]
> +; IS__TUNIT____-NEXT:    [[CALL2:%.*]] = call i32*
> @external_sink_ret2_nrw(i32* nofree [[N0]], i32* nocapture nofree readonly
> align 4 [[R0]], i32* nofree writeonly "no-capture-maybe-returned" [[W0]])
> #[[ATTR3]]
>  ; IS__TUNIT____-NEXT:    [[CALL3:%.*]] = call i32* @internal_ret1_rw(i32*
> nofree align 4 [[R0]], i32* nofree [[W0]]) #[[ATTR3]]
>  ; IS__TUNIT____-NEXT:    ret i32* [[CALL3]]
>  ;
> @@ -51,7 +51,7 @@ define i32* @external_ret2_nrw(i32* %n0, i32* %r0, i32*
> %w0) {
>  ; IS__CGSCC____-NEXT:  entry:
>  ; IS__CGSCC____-NEXT:    [[CALL:%.*]] = call i32* @internal_ret0_nw(i32*
> nofree [[N0]], i32* nofree [[W0]]) #[[ATTR2:[0-9]+]]
>  ; IS__CGSCC____-NEXT:    [[CALL1:%.*]] = call i32*
> @internal_ret1_rrw(i32* nofree align 4 [[R0]], i32* nofree align 4 [[R0]],
> i32* nofree [[W0]]) #[[ATTR2]]
> -; IS__CGSCC____-NEXT:    [[CALL2:%.*]] = call i32*
> @external_sink_ret2_nrw(i32* nofree [[N0]], i32* nocapture nofree readonly
> [[R0]], i32* nofree writeonly [[W0]]) #[[ATTR3:[0-9]+]]
> +; IS__CGSCC____-NEXT:    [[CALL2:%.*]] = call i32*
> @external_sink_ret2_nrw(i32* nofree [[N0]], i32* nocapture nofree readonly
> align 4 [[R0]], i32* nofree writeonly [[W0]]) #[[ATTR3:[0-9]+]]
>  ; IS__CGSCC____-NEXT:    [[CALL3:%.*]] = call i32* @internal_ret1_rw(i32*
> nofree align 4 [[R0]], i32* nofree [[W0]]) #[[ATTR2]]
>  ; IS__CGSCC____-NEXT:    ret i32* [[CALL3]]
>  ;
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220622/380beecd/attachment-0001.html>


More information about the llvm-commits mailing list