[PATCH] D119532: [RISCV] Extend sext.w removal pass to remove unused sign-extensions

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 16 22:45:25 PST 2022


craig.topper added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVSExtWRemoval.cpp:116
+    case RISCV::SLLI:
+      if (MI->getOperand(2).getImm() >= 32)
+        continue;
----------------
The register form is handled without knowing anything about the shift amount operand. So why does the immediate value matter?


================
Comment at: llvm/lib/Target/RISCV/RISCVSExtWRemoval.cpp:120
+      continue;
+    case RISCV::ANDI:
+      if (isUInt<11>(MI->getOperand(2).getImm()))
----------------
Similar question.


================
Comment at: llvm/lib/Target/RISCV/RISCVSExtWRemoval.cpp:298
+    case RISCV::BSETI:
+      if (MI->getOperand(2).getImm() >= 32)
+        return false;
----------------
Can't changing bit 31 break the sign extension?


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

https://reviews.llvm.org/D119532



More information about the llvm-commits mailing list