[llvm] 3794cc0 - [InstCombine] invert canonicalization for cast of signbit test

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon May 16 14:12:08 PDT 2022


Hi

> On May 16, 2022, at 17:56, Sanjay Patel via llvm-commits <llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>> wrote:
> 
> 
> Author: Sanjay Patel
> Date: 2022-05-16T12:55:52-04:00
> New Revision: 3794cc0e996481e10307b67c8436aa44e0d65d22
> 
> URL: https://github.com/llvm/llvm-project/commit/3794cc0e996481e10307b67c8436aa44e0d65d22 <https://github.com/llvm/llvm-project/commit/3794cc0e996481e10307b67c8436aa44e0d65d22>
> DIFF: https://github.com/llvm/llvm-project/commit/3794cc0e996481e10307b67c8436aa44e0d65d22.diff <https://github.com/llvm/llvm-project/commit/3794cc0e996481e10307b67c8436aa44e0d65d22.diff>
> 
> LOG: [InstCombine] invert canonicalization for cast of signbit test
> 
> The existing transform was wrong in 3 ways:
> 1. It created an extra instruction when the source and dest types don't match.
> 2. It did not account for an extra use of the icmp, so could create 2 extra insts.
> 3. It favored bit hacks over icmp (icmp generally has better analysis).
> 
> This fixes #54692 (modeled by the PhaseOrdering tests).
> 
> This is a minimal step to fix the bug, but we should likely invert
> the sibling transform for the "is negative" pattern too.
> 
> The backend should be able to invert this back to a shift if that
> leads to better codegen.


I believe this change may be causing a hang in bootstrap builds when building llvm-project/clang/unittests/Frontend/CompilerInvocationTest.cpp during stage2. With this patch reverted, building that file completes within 5 seconds. With the patch, Clang spins in instcombine.

It looks like the following bots are timing out because of this:

https://lab.llvm.org/buildbot#builders/179/builds/3688 <https://lab.llvm.org/buildbot#builders/179/builds/3688>
https://lab.llvm.org/buildbot#builders/85/builds/8641 <https://lab.llvm.org/buildbot#builders/85/builds/8641>
https://lab.llvm.org/buildbot#builders/168/builds/6486 <https://lab.llvm.org/buildbot#builders/168/builds/6486>
https://lab.llvm.org/buildbot#builders/74/builds/11107 <https://lab.llvm.org/buildbot#builders/74/builds/11107>

It might be good to revert the change if it cannot be fixed quickly, to get the bots back to green.

Cheers,
Florian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220516/f482c01d/attachment.html>


More information about the llvm-commits mailing list