[PATCH] D79909: [X86] Fix a regression caused by moving combineLoopMAddPattern to IR

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 13 14:42:47 PDT 2020


craig.topper created this revision.
craig.topper added reviewers: RKSimon, spatel.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.

When I moved combineLoopMAddPattern to an IR pass. I didn't match the behavior of canReduceVMulWidth that was used in the SelectionDAG version. canReduceVMulWidth just calls computeSignBits and assumes a truncate is always profitable. The version I put in IR just looks for constants and zext/sext. Though I neglected to check the number of bits in input of the zext/sext.

This patch adds a check for the number of input bits to the sext/zext. And it adds a special case for add/sub with zext/sext inputs which can be handled by combineTruncatedArithmetic. Match the original SelectionDAG behavior appears to be a regression in some cases if the truncate isn't removed and becomes pack and permq. So enabled only this specific case is the conservative approach.


https://reviews.llvm.org/D79909

Files:
  llvm/lib/Target/X86/X86PartialReduction.cpp
  llvm/test/CodeGen/X86/madd.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79909.263856.patch
Type: text/x-patch
Size: 7308 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200513/76cc4c5c/attachment.bin>


More information about the llvm-commits mailing list