[PATCH] D113442: [InstCombine] Enable fold select into operand for FAdd, FMul, and FSub.
Huihui Zhang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 9 15:22:01 PST 2021
huihuiz added a comment.
Thanks Sanjay for the comments, I will update unit test as suggested.
I have some concern when I checked with alive2, for fadd https://alive2.llvm.org/ce/z/UjAMM_ alive2 complaints mis-matched outputs.
For integer add this folding seems correct https://alive2.llvm.org/ce/z/oE4UQJ
Let me know if such transformation would be illegal for floating point type as alive2 pointed out, or there is anything I missed before I go fixing the unit test ?
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:257
case Instruction::Sub: // Can only fold on the amount subtracted.
+ case Instruction::FSub:
case Instruction::Shl: // Can only fold on the shift amount.
----------------
spatel wrote:
> Why exclude fdiv?
I checked with alive2, looks like adding fdiv, sdiv and udiv will trigger undefined behavior
https://alive2.llvm.org/ce/z/KvFYev
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D113442/new/
https://reviews.llvm.org/D113442
More information about the llvm-commits
mailing list