[PATCH] D124119: [InstCombine] Combine instructions of type or/and where AND masks can be combined.

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 1 08:18:20 PDT 2022


spatel added a comment.

We should have at least one minimized version of the test that caused the infinite loop in the updated version of the patch or pre-committed, so we guard against that same bug in the future.

I didn't step through to see if more can be removed, but I got it down to this, and it would infinite loop with "opt -instcombine":

  declare void @use(i32)
  
  define i32 @f(i32 %a, i32 %b) {
    %shr = ashr i32 %a, 23
    %conv = trunc i32 %shr to i8
    %conv1 = zext i8 %conv to i32
    %and = and i32 %conv1, 925
    call void @use(i32 %and)
    %and3 = and i32 %shr, %b
    %or = or i32 %and3, %and
    %shr8 = ashr i32 %b, 23
    %and9 = and i32 %shr8, 157
    %r = or i32 %or, %and9
    ret i32 %r
  }


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

https://reviews.llvm.org/D124119



More information about the llvm-commits mailing list