This tries to tackle https://bugs.llvm.org/show_bug.cgi?id=52259
Intersect the FMF of the select's operands. If the operand is not a FPMathOperator e.g. an argument then try to take the flag from the function's attributes.
Paths
| Differential D112283
[Instcombine] Try to get select's FMFs from its operands AbandonedPublic Authored by mnadeem on Oct 21 2021, 5:06 PM.
Details
Summary This tries to tackle https://bugs.llvm.org/show_bug.cgi?id=52259 Intersect the FMF of the select's operands. If the operand is not a FPMathOperator e.g. an argument then try to take the flag from the function's attributes.
Diff Detail Event TimelineComment Actions Using function attributes is what we're trying to get away from by having instruction-level FMF, so this would have to be clearly labeled as a hack or temporary fix. That said, I don't think anyone is working on a real fix that would apply FMF to all FP values. That was a comment I made in: I think that's also the root cause for the failure in the motivating bug/test for this patch: This fabs example is worth posting to llvm-dev for wider discussion. I think we do need to do something to optimize that code, but there's no clear fix that I know of.
Revision Contents
Diff 381435 llvm/include/llvm/IR/Operator.h
llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
llvm/test/Transforms/InstCombine/minmax-fold.ll
llvm/test/Transforms/PhaseOrdering/fmf-select-abs.ll
|