[PATCH] D9379: llvm.noalias - don't interfere with llvm.assume

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 16 16:03:34 PDT 2017


Hal, several of these have been previously approved.  Please either land 
them or close them.  We trust you to rebase correctly and call out 
anything that needs particular attention.  :)


On 08/14/2017 07:51 PM, Hal Finkel via Phabricator wrote:
> hfinkel updated this revision to Diff 111117.
> hfinkel added a comment.
>
> Rebased.
>
>
> https://reviews.llvm.org/D9379
>
> Files:
>    lib/Analysis/ValueTracking.cpp
>    test/Transforms/InstCombine/assume.ll
>
>
> Index: test/Transforms/InstCombine/assume.ll
> ===================================================================
> --- test/Transforms/InstCombine/assume.ll
> +++ test/Transforms/InstCombine/assume.ll
> @@ -275,6 +275,26 @@
>     ret i1 %rval
>   }
>   
> +define i1 @nonnull5(i32** %a) {
> +entry:
> +  %load = load i32*, i32** %a
> +  ;; This call cannot actually trap, and so should not disrupt the assume.
> +  %v = call i32* @llvm.noalias.p0i32(i32* %load, metadata !1)
> +  %cmp = icmp ne i32* %load, null
> +  tail call void @llvm.assume(i1 %cmp)
> +  %q = bitcast i32** %a to i32*
> +  %rval = icmp eq i32* %v, %q
> +  ret i1 %rval
> +
> +; CHECK-LABEL: @nonnull5
> +; CHECK: !nonnull
> +; CHECK-NOT: call void @llvm.assume
> +}
> +
> +declare i32* @llvm.noalias.p0i32(i32*, metadata) nounwind
> +
> +!0 = !{!0, !"some domain"}
> +!1 = !{!1, !0, !"some scope"}
>   
>   attributes #0 = { nounwind uwtable }
>   attributes #1 = { nounwind }
> Index: lib/Analysis/ValueTracking.cpp
> ===================================================================
> --- lib/Analysis/ValueTracking.cpp
> +++ lib/Analysis/ValueTracking.cpp
> @@ -411,6 +411,7 @@
>         case Intrinsic::invariant_end:
>         case Intrinsic::lifetime_start:
>         case Intrinsic::lifetime_end:
> +      case Intrinsic::noalias:
>         case Intrinsic::objectsize:
>         case Intrinsic::ptr_annotation:
>         case Intrinsic::var_annotation:
>
>



More information about the llvm-commits mailing list