[llvm] [RISCV] Eliminate redundant materializations after register comparison (PR #227673)

via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 30 22:47:51 PDT 2026


================
@@ -131,8 +158,34 @@ bool RISCVRedundantCopyElimination::optimizeBlock(MachineBasicBlock &MBB) {
     return false;
 
   bool IsZeroCopy = guaranteesZeroRegInBlock(MBB, Cond, TBB);
+  bool IsImmCopy = guaranteesRegEqualsImmInBlock(MBB, Cond, TBB);
----------------
tinfengyu wrote:

Yes, that makes sense. I've restored the short-circuit so guaranteesRegEqualsImmInBlock is only called when IsZeroCopy is false.

https://github.com/llvm/llvm-project/pull/227673


More information about the llvm-commits mailing list