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

Xiang Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 15 04:01:24 PDT 2021


xiangzhangllvm created this revision.
xiangzhangllvm added reviewers: craig.topper, RKSimon, LuoYuanke, pengfei.
Herald added a subscriber: hiraditya.
xiangzhangllvm requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Adding AssertZext AssertSext in promoting FP_TO_INT is not safe.

for example:
t3: v8i8 = fp_to_uint t2  --promote to-->  t4: v8i16 = fp_to_sint t2   +    t5: v8i16 = AssertZext t86, ValueType:ch:i8
will let following optimization see the "high 8-bits of each element of t5" == 0. (but it is not, it may be undef, when there is overflow in fp_to_uint )

So some setting t5's "high 8-bits of each element" action will be optimized out. 
And finally cause calculation error.

Related commit: https://reviews.llvm.org/D40591
Related optimization: https://reviews.llvm.org/rG2a419a0b9957ebac9e11e4b43bc9fbe42a9207df


https://reviews.llvm.org/D106053

Files:
  llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp
  llvm/test/CodeGen/X86/avx-cvt-2.ll
  llvm/test/CodeGen/X86/avx512-cvt.ll
  llvm/test/CodeGen/X86/min-legal-vector-width.ll
  llvm/test/CodeGen/X86/vec-strict-fptoint-128.ll
  llvm/test/CodeGen/X86/vec-strict-fptoint-256.ll
  llvm/test/CodeGen/X86/vec-strict-fptoint-512.ll
  llvm/test/CodeGen/X86/vec_cast2.ll
  llvm/test/CodeGen/X86/vec_fp_to_int.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106053.358910.patch
Type: text/x-patch
Size: 31563 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210715/474da47d/attachment-0001.bin>


More information about the llvm-commits mailing list