[PATCH] D76800: [InstCombine] Fix Incorrect fold of ashr+xor -> lshr w/ vectors

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 25 14:38:46 PDT 2020


lebedev.ri requested changes to this revision.
lebedev.ri added a comment.
This revision now requires changes to proceed.

What we need to do here is "define" undef to be 0.

  ----------------------------------------
  define <4 x i5> @test_v4i5_not_ashr_negative_const_undef(<4 x i5> %a0) {
  %0:
    %1 = ashr <4 x i5> { 29, 27, undef, 23 }, %a0
    %2 = xor <4 x i5> { 31, 31, 31, undef }, %1
    ret <4 x i5> %2
  }
  =>
  define <4 x i5> @test_v4i5_not_ashr_negative_const_undef(<4 x i5> %a0) {
  %0:
    %1 = lshr <4 x i5> { 2, 4, 0, 8 }, %a0
    ret <4 x i5> %1
  }
  Transformation seems to be correct!
  
  Summary:
    1 correct transformations
    0 incorrect transformations
    0 Alive2 errors

There was some utility for that already, but i don't recall how it's called..


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76800





More information about the llvm-commits mailing list