Skip to content

Support folding n-ary intrinsics in IRBuilderFolder/ConstantFolding #153743

@lukel97

Description

@lukel97

The motivation for this is #153069, where we would like to avoid regressions by being able to simplify unary and ternary intrinsics in IRBuilderFolder.

Currently we can only fold binary intrinsics. I presume we want to change the IRBuilderFolder interface from FoldBinaryIntrinsic -> FoldIntrinsic. I'm not sure what needs to change in ConstantFolder.cpp though. I see we have ConstantFoldBinaryIntrinsic, but we also seem to handle scalar intrinsics in ConstantFoldCall?

The only folding we really need for #153069 is propagating poison, i.e. intrinsicPropagatesPoison

Some relevant discussion in #150931 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    constant-foldingProblems related to constant folding in the optimizerllvm:instcombineCovers the InstCombine, InstSimplify and AggressiveInstCombine passes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions