[llvm] [InstCombine] Fold more 'fcmp' 'select' instrs idioms into 'fabs' (PR #83381)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 18 00:07:38 PDT 2024


arsenm wrote:

> +  if(BB->getParent()->hasFnAttribute("unsafe-fp-math")){
> +    PN->setFast(true);
> +  }
> +

I don't think unsafe-fp-math actually directly corresponds to setting all fast math flags, but it's so poorly defined I think it's impossible to make a conclusive statement 

>    PN->insertBefore(BB->begin());
>    ++NumPHIInsert;
>    PhiToAllocaMap[PN] = AllocaNo;
> ```
> 
> Is this the direction you were hinting towards?

I don't think so. I think the idea was to introduce the flags on the phi based on the context instructions when eliminating the alloca. The whole reason to move it here was to avoid relying on the fast math attributes 

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


More information about the llvm-commits mailing list