[llvm] [RISCV] Restrict combineOp_VLToVWOp_VL w/ bf16 to vfwmadd_vl with zvfbfwma (PR #108798)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 16 10:58:04 PDT 2024


topperc wrote:

> > Do we need to do this check when we check the other users too?
> > ```
> >     auto AppendUsersIfNeeded = [&Worklist, &Subtarget,                           
> >                                 &Inserted](const NodeExtensionHelper &Op) {      
> >       if (Op.needToPromoteOtherUsers()) {                                        
> >         for (SDNode::use_iterator UI = Op.OrigOperand->use_begin(),              
> >                                   UE = Op.OrigOperand->use_end();                
> >              UI != UE; ++UI) {                                                   
> >           SDNode *TheUse = *UI;                                                  
> >           if (!NodeExtensionHelper::isSupportedRoot(TheUse, Subtarget))          
> >             return false;                                                        
> >           // We only support the first 2 operands of FMA.                        
> >           if (UI.getOperandNo() >= 2)                                            
> >             return false;                                                        
> >           if (Inserted.insert(TheUse).second)                                    
> >             Worklist.push_back(TheUse);                                          
> >         }                                                                        
> >       }                                                                          
> >       return true;                                                               
> >     }; 
> > ```
> 
> If I'm reading this right, won't the other users of the extended bf16 ops go back onto the worklist, where they'll then have their LHS/RHS checked through the same NodeExtensionHelper constructor? With Root now set to the new user

I think `AppendUsersIfNeeded` is responsible for checking if all uses of the extend can be converted to a widening operation. If we have an FMA and an FADD using the same bf16 fp_extend, will be turn the FMA into a widening extned, but leave the FADD using the original extend?

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


More information about the llvm-commits mailing list