[PATCH] D156442: [RISCV][Backend] Zext flag conversion in RISC-V Backend

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 1 15:39:43 PDT 2023


craig.topper added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVCodeGenPrepare.cpp:92
+  // Look for a non negative zext(value) and replace it with sext.
+	if (isKnownNonNegative(Src, *DL, 0, AC, Ctxi)) {
+    auto SExt = new SExtInst(Src, ZExt.getType(), "", &ZExt);
----------------
Could we have InstCombine call isKnownNonNegative during visitZExt and set the flag if the input is non negative? Then we only need the code here that checks the flag.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D156442



More information about the llvm-commits mailing list