[PATCH] D159537: [AArch64] Don't rely on (zext (trunc x)) pattern to detect zext_inreg MULL patterns - use value tracking directly

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 21 05:55:57 PDT 2023


RKSimon created this revision.
RKSimon added reviewers: dmgreen, jaykang10, david-arm.
Herald added subscribers: hiraditya, kristof.beyls.
Herald added a project: All.
RKSimon requested review of this revision.
Herald added a project: LLVM.

As explained on D159533 <https://reviews.llvm.org/D159533>, I'm trying to generalize the "(zext (trunc x)) -> x iff the upper bits are known zero" fold in getNode() and I was seeing assertions in the aarch64 mull matching code as it was assuming these 'zero-extend-inreg' patterns will remain from earlier in the fold.

Instead I've updated selectUmullSmull/skipExtensionForVectorMULL to just use value tracking to detect when the upper bits are known zero, and to insert the truncation nodes there if necessary.

I really don't like creating SDValue(N, 0) on the fly from SDNode value as technically we could be using any result index from these nodes - so I've ended up cleaning up a lot of mul code to use SDValue directly instead of peeking through to the SDNode. I'm happy to undo this and just rely use SDValue(N, 0) if there's resistance, but this is much cleaner imo. I'd push this change as pre-commit NFC.

(Sorry for still using Phab but I'm frantically trying to get my local backlog dealt with before moving over to using github branches).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D159537

Files:
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159537.557174.patch
Type: text/x-patch
Size: 9117 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230921/a828b62d/attachment.bin>


More information about the llvm-commits mailing list