[PATCH] D53342: [SimplifyLibCalls][WIP] Mark known arguments with nonnull

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 23 11:57:47 PDT 2018


spatel added a comment.

In https://reviews.llvm.org/D53342#1272804, @xbolva00 wrote:

> https://pastebin.com/8bxCuV5V + this patch
>  opt -instcombine p.ll -S
>
> After I mark it, CI->dump() prints "  %call = call i64 @strlen(i8* nonnull %s) #2" but later, some code turns this to undef.


You can't return the same value, or you'll invoke instcombine's RAUW function which does this:

  // If we are replacing the instruction with itself, this must be in a
  // segment of unreachable code, so just clobber the instruction.
  if (&I == V)
    V = UndefValue::get(I.getType());


https://reviews.llvm.org/D53342





More information about the llvm-commits mailing list