[PATCH] D99354: [SimpleLoopUnswitch] Port partially invariant unswitch from LoopUnswitch to SimpleLoopUnswitch

JinGu Kang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 18 02:21:54 PDT 2021


jaykang10 added a comment.

In D99354#2949165 <https://reviews.llvm.org/D99354#2949165>, @jaykang10 wrote:

> In D99354#2949059 <https://reviews.llvm.org/D99354#2949059>, @xbolva00 wrote:
>
>> In D99354#2912791 <https://reviews.llvm.org/D99354#2912791>, @jaykang10 wrote:
>>
>>> In D99354#2903817 <https://reviews.llvm.org/D99354#2903817>, @fhahn wrote:
>>>
>>>> @jaykang10 it looks like this patch regressed codegen in some cases: https://bugs.llvm.org/show_bug.cgi?id=51139. It would be great if you could take a look.
>>>
>>> Ah, let me have a look.
>>
>> Maybe revert while investigating?
>
> As I mentioned on https://bugs.llvm.org/show_bug.cgi?id=51141, I am not sure the unswitch pass has to detect the cases which the loop load pre, sccp or other passes can optimize and the pass do not unswitch the loop...
> I am creating a patch to fix https://bugs.llvm.org/show_bug.cgi?id=51141 first. The patch does not fix https://bugs.llvm.org/show_bug.cgi?id=51139. Once I create it, let me add you as reviewer.

For https://bugs.llvm.org/show_bug.cgi?id=51139, I have added below comment on it.

  In this case, the inliner pass fails to inline the function g after unswitch because of the cost as below debug message.
  
  NOT Inlining (cost=250, threshold=250), Call:   call void @g(i32 %2) #3
  
  Originally, after inlining function g, the JumpThreading pass made the block with call @foo dead and SimplifyCFG pass deleted it.
  
  If you add `always_inline` attribute to the function g's prototype as below, you can see the callfoo is gone.
  
  void g(int h) __attribute__((always_inline));

In this case, as I mentioned previously, I am not sure the unswitch pass has to check the inline cost or something like that... If someone has idea about it, please let me know.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99354



More information about the llvm-commits mailing list