[llvm] [IRBuilder] Fold binary intrinsics (PR #80743)

Artem Tyurin via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 11 04:00:41 PST 2024


agentcooper wrote:

I've implemented `FoldBinaryIntrinsic` in all 3 folders: ConstantFolder, TargetFolder, InstSimplifyFolder.

In case of the TargetFolder I split the `ConstantFoldScalarCall2` into 2 functions: `ConstantFoldLibCall2` that handles `LibFunc` and `ConstantFoldIntrinsicCall2` that handles intrinsics and is reused.

I've also switched the return type for `CreateBinaryIntrinsic` from `CallInst` to `Value` to reflect the fact that it can be folded.

In case of ConstantFolder I've created a new `ConstantFoldBinaryIntrinsicInstruction` which now has the code that was previously in SLPVectorizer.

Not sure why Windows build is failing, but Linux one is passing.

@nikic Could you please take another look?

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


More information about the llvm-commits mailing list