[PATCH] D75799: [JumpThreading] Don't create PHI nodes with "is.constant" values

Bill Wendling via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 9 12:25:21 PDT 2020


void added a comment.

In D75799#1912044 <https://reviews.llvm.org/D75799#1912044>, @lebedev.ri wrote:

> In D75799#1911874 <https://reviews.llvm.org/D75799#1911874>, @void wrote:
>
> > This is after jump threading:
>
>
> Are you sure that is the correct snippet? Because if it is, i'm lost completely.


Yes. I just elided some parts that aren't super relevant. I can supply a preprocessed file though.

>> It turns out that during jump threading, the `if.end616` block has a constant and non-constant value coming into it and are combined in a PHI node. This is why the block is duplicated (a constant block `if.end616.thread` and non-constant `if.end616`). But this messes with the `llvm.is.constant` intrinsic, which looks at that value:
>> 
>>   if.end616.thread:
>>     %len.0204 = phi i32 [ 24, %if.end603 ]
>>     %conv617205 = sext i32 %len.0204 to i64 
>>     %cmp3.i.i181 = icmp ugt i32 %len.0204, 24 
>>     %177 = call i1 @llvm.is.constant.i64(i64 %conv617205)                                                                  
>>     br i1 %cmp3.i.i181, label %if.then.i.i182, label %if.end12.i.i185
>>   
>>   if.end616:                                                                 
>>     %len.0 = phi i32 [ %conv592, %if.end603 ]
>>     %conv617 = sext i32 %len.0 to i64 
>>     %cmp3.i.i181 = icmp ugt i32 %len.0, 24 
>>     %178 = call i1 @llvm.is.constant.i64(i64 %conv617)                                                                  
>>     br i1 %cmp3.i.i181, label %if.then.i.i182, label %if.end12.i.i185
> 
> I'm not seeing `@if.end603` and `@if.end616.thread`, in `This is after jump threading:` snippet.

The `@if.end616.thread` that's relevant is in the last code block above. I mistakenly omitted it from the previous example.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75799/new/

https://reviews.llvm.org/D75799





More information about the llvm-commits mailing list