[llvm] [InstSimplify] Fold poison/nnan/ninf on @llvm.sqrt (PR #141821)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Wed May 28 12:01:19 PDT 2025


lukel97 wrote:

> I think the correct starting point here would be to support poison propagation in ConstantFolding rather than InstSimplify. I think
> 
> https://github.com/llvm/llvm-project/blob/b03558080eda9ebe3955afdd52aed902c5087310/llvm/lib/Analysis/ConstantFolding.cpp#L2209
> 
> is the relevant code for this case.
> To generalize things, something to consider would be to handle this centrally based on the propagatesPoison() VT query. Which, incidentally, does not list the FP intrinsics.

I saw that case in ConstantFolding but it looks like we currently only fold scalar intrinsics, and for my use case I need to fold scalable vectors. 

I think fixed length vectors would get their poison propagated if we extended the case in ConstantFoldScalarCall1. Maybe we should look into constant folding splats of scalable vector intrinsics instead then?

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


More information about the llvm-commits mailing list