[PATCH] D110170: [InstCombine] fold cast of right-shift if high bits are not demanded

Mikael Holmén via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 23 22:59:55 PDT 2021


uabelho added a comment.

In D110170#3019717 <https://reviews.llvm.org/D110170#3019717>, @uabelho wrote:

> Just a heads-up, I'm seeing timeouts again now with "2nd try" commited.
>
> I'll see if I can pull out a reproducer working on main too.

Ok:

  opt -o /dev/null -passes='instcombine' hang.ll

with hang.ll being

  target datalayout = "n32"
  
  define i32 @f_t15_t01_t09(i40 %x) {
  entry:
    store i40 %x, i40* undef, align 1
    %0 = load i40, i40* undef, align 1
    %1 = add i40 %0, 2147483647
    %2 = select i1 undef, i40 %1, i40 %0
    %downscale = ashr i40 %2, 31
    %resize = trunc i40 %downscale to i16
    %resize1 = sext i16 %resize to i32
    %upscale = shl i32 %resize1, 31
    ret i32 %upscale
  }


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110170



More information about the llvm-commits mailing list