[PATCH] D98791: [PowerPC][NFC] Do not enter prefix selection if it cannot do better.
    Victor Huang via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Mon Mar 22 07:18:59 PDT 2021
    
    
  
NeHuang added inline comments.
================
Comment at: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1174
+  // selection used one instruction we cannot do better.
+  if (Subtarget.hasPrefixInstrs() && InstCntDirect != 1) {
     unsigned InstCntDirectP = 0;
----------------
stefanp wrote:
> NeHuang wrote:
> > Please correct me if I my understand is wrong here. It seems to me `InstCntDirect=1` case has been covered in the check below.
> > ```   
> >  // If the prefix and non-prefix cases use the same number of instructions
> > // we will prefer the non-prefix case.
> >     if (ResultP && (!Result || InstCntDirectP < InstCntDirect))
> > ```
> > Then intention of adding an early exit for `InstCntDirect == 1` case is to save the trial of calling `selectI64ImmDirectPrefix` and further checks below. 
> Yes that is correct. There is no need to call `selectI64ImmDirectPrefix` if we already know that it will fail the check `InstCntDirectP < InstCntDirect` and that the result it produces won't be used.
Thanks. LGTM. 
Repository:
  rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98791/new/
https://reviews.llvm.org/D98791
    
    
More information about the llvm-commits
mailing list