[PATCH] D130543: [RISCV]Enable isIntDivCheap when attribute is minsize

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 26 09:37:49 PDT 2022


craig.topper added a comment.

This code in ReplaceNodeResults needs to call isIntDivCheap so that we promote div by constant when isIntDivCheap returns false. That will fix `testsize2` and `testsize4` to use divw and divuw for RV64IM.

  case ISD::SDIV:                                                                
  case ISD::UDIV:                                                                
  case ISD::UREM: {                                                              
    MVT VT = N->getSimpleValueType(0);                                           
    assert((VT == MVT::i8 || VT == MVT::i16 || VT == MVT::i32) &&                
           Subtarget.is64Bit() && Subtarget.hasStdExtM() &&                      
           "Unexpected custom legalisation");                                    
    // Don't promote division/remainder by constant since we should expand those 
    // to multiply by magic constant.                                            
    // FIXME: What if the expansion is disabled for minsize.                     
    if (N->getOperand(1).getOpcode() == ISD::Constant)                           
      return;


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130543



More information about the llvm-commits mailing list