[PATCH] D131503: [DAGCombine] Combine signext_inreg of extract-extend

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 11 03:47:41 PDT 2022


RKSimon added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:13170
+      SDValue SignExtExtendee =
+          DAG.getNode(ISD::SIGN_EXTEND, SDLoc(N), InnerExtVT, Extendee);
+      return DAG.getNode(ISD::EXTRACT_SUBVECTOR, SDLoc(N), VT, SignExtExtendee,
----------------
david-arm wrote:
> peterwaller-arm wrote:
> > RKSimon wrote:
> > > Does this need an operation legality check for ISD::SIGN_EXTEND ? `(!LegalOperations || TLI.isOperationLegal(ISD::SIGN_EXTEND, InnerExtVT))`?
> > The combine only replaces an extant any-extend with an equivalent sign-extend. Is it an unreasonable assumption that if a target supports an any-extend it won't support the equivalent sign or zero extend? I can add the condition if you think this is suspect.
> I guess it's not just replacing an ANY_EXTEND with SIGN_EXTEND - it also replaces ZERO_EXTEND with SIGN_EXTEND too, although the transformation looks valid. I guess I have the same question as @peterwaller-arm - would a target have a legal SIGN_EXTEND, but illegal ZERO_ or ANY_EXTEND?
Its unlikely I agree - are the tests affected if we add the legality check?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131503



More information about the llvm-commits mailing list