[llvm] [PredicateInfo] Support existing `PredicateType` by adding `PredicatePHI` when needing introduction of phi nodes (PR #151132)

Rajveer Singh Bharadwaj via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 2 06:27:23 PDT 2025


Rajveer100 wrote:

> ```c++
> 
>   for (Value *Op : OpsToRename) {
> 
>     if (NewPHIs.count(Op)) {
> 
>       Value *PHI = PHIs[Op];
> 
>       SmallVector<Use *, 8> UsesToReplace;
> 
>       for (Use &U : Op->uses()) {
> 
>         if (Instruction *I = dyn_cast<Instruction>(U.getUser())) {
> 
>           if (I->getParent() == PHI->getParent()) {
> 
>             UsesToReplace.push_back(&U);
> 
>           }
> 
>         }
> 
>       }
> 
>       for (Use *U : UsesToReplace) {
> 
>         U->set(PHI);
> 
>       }
> 
>     }
> 
>   }
> 
> ```
> 
> 
> 
> This is what I am talking about, this is quite inefficient as compared to what I have done even though we introduced a new `PredicatePHI`.

@fhahn 
Could you look into this.

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


More information about the llvm-commits mailing list