[PATCH] D106053: [CodeGen] Remove pending AssertZext AssertSext in promoting FP_TO_INT

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 17 11:45:04 PDT 2021


efriedma added a comment.

In D106053#2885502 <https://reviews.llvm.org/D106053#2885502>, @craig.topper wrote:

> Ok that makes sense if the bitcast existed in IR. But this bitcast was created as part of type legalization and potentially spread poison to adjacent elements that didn't happen in the IR.

Are you asking if it's legal to turn src into tgt in the following?

  define <4 x i8> @src(<1 x float> %a) {
    %u = fptoui <1 x float> %a to <1 x i8>
    %s = shufflevector <1 x i8> %u, <1 x i8> undef, <4 x i32> <i32 0, i32 undef, i32 undef, i32 undef>
    ret <4 x i8> %s
  }
  
  define <4 x i8> @tgt(<1 x float> %a) {
    %u = fptoui <1 x float> %a to <1 x i32>
    %and = bitcast <1 x i32> %u to <4 x i8>
    ret <4 x i8> %and
  }

I think according to current LangRef rules, it technically isn't; we're turning undef into poison.  But we're probably going to change shufflevector so we have "poison" in the shuffle mask instead of undef, so the result of the shufflevector has poison elements.  So probably not worth spending time on this at the moment.  See discussion on https://bugs.llvm.org/show_bug.cgi?id=44185 .


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

https://reviews.llvm.org/D106053



More information about the llvm-commits mailing list