[PATCH] D18738: Add new !unconditionally_dereferenceable load instruction metadata

Hal Finkel via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 10 11:50:36 PST 2016


hfinkel added a comment.

In https://reviews.llvm.org/D18738#390736, @sanjoy wrote:

> In https://reviews.llvm.org/D18738#390734, @whitequark wrote:
>
> >
>
>
>
>
> > However, this is something that already happens in LLVM. Consider this testcase:


...

> Inlining into bar =>
> 
> (Edited: the inlined code earlier was incorrect)
> 
>   void bar(int* ptr) {
>     int* k1 = foo1(ptr, true);
>     // inlined int* k2 = foo_common(alloca(...), false);
>     t = alloca(...)
>     int* val;
>     if (false) {
>       val = *t, unconditionally_dereferenceable
>     } else {
>       val = *ptr
>     }
>   }

The assumption is placed on the return value, and val would not unconditionally have the assumption, and so never will really, so there's not a problem here (AFAIKT).


Repository:
  rL LLVM

https://reviews.llvm.org/D18738





More information about the llvm-commits mailing list