[PATCH] D134621: [RISCV][WIP] Teach SExtWRemoval to recognize sign extended values that come from arguments.

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 28 08:20:02 PDT 2022


arsenm added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:10568-10572
+    Argument *OrigArg = MF.getFunction().getArg(In.getOrigArgIndex());
+    if (OrigArg->getType()->isIntegerTy()) {
+      unsigned BitWidth = OrigArg->getType()->getIntegerBitWidth();
+      // An input zero extended from i31 can also be considered sign extended.
+      if ((BitWidth <= 32 && In.Flags.isSExt()) ||
----------------
Don't see why you need to look at the underlying IR here instead of just relying on the argument flags


================
Comment at: llvm/lib/Target/RISCV/RISCVSExtWRemoval.cpp:9
 //
 // This pass removes unneeded sext.w instructions at the MI level.
 //
----------------
It feels wrong to me that you would need to optimize these after selection but I guess I don't know why you are seeing these


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134621



More information about the llvm-commits mailing list