[PATCH] D156058: [InstCombine] Fix bug in canonicalization of Pow2 Tests (From: D152673)

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 23 09:10:53 PDT 2023


goldstein.w.n added a comment.

Also for the other two test changes:

  ----------------------------------------
  define i1 @blsmsk_is_p2_or_z_fail(i32 %xx, i32 %yy) {
  %0:
    %x = or i32 %xx, %yy
    %xm1 = add i32 %x, 4294967295
    %y = xor i32 %x, %xm1
    %r = icmp ugt i32 %x, %y
    ret i1 %r
  }
  =>
  define i1 @blsmsk_is_p2_or_z_fail(i32 %xx, i32 %yy) nofree willreturn memory(none) {
  %0:
    %x = or i32 %yy, %xx
    %1 = ctpop i32 %x
    %1_range = !range i32 %1, i32 0, i32 33
    %r = icmp ugt i32 %1_range, 1
    ret i1 %r
  }
  Transformation seems to be correct!
  
  
  ----------------------------------------
  define i1 @blsmsk_is_p2_or_z(i32 %xx, i32 %yy) {
  %0:
    %x = or i32 %xx, %yy
    %xm1 = add i32 %x, 4294967295
    %y = xor i32 %x, %xm1
    %r = icmp uge i32 %x, %y
    ret i1 %r
  }
  =>
  define i1 @blsmsk_is_p2_or_z(i32 %xx, i32 %yy) nofree willreturn memory(none) {
  %0:
    %x = or i32 %yy, %xx
    %xm1 = add i32 %x, 4294967295
    %y = xor i32 %xm1, %x
    %r = icmp uge i32 %x, %y
    ret i1 %r
  }
  Transformation seems to be correct!
  
  Summary:
    2 correct transformations
    0 incorrect transformations
    0 failed-to-prove transformations
    0 Alive2 errors


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D156058



More information about the llvm-commits mailing list