diff options
author | Sanjay Patel <spatel@rotateright.com> | 2019-06-10 15:39:00 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2019-06-10 15:39:00 +0000 |
commit | 9650c95b7e55791faca4800c8f14f8325942a3b7 (patch) | |
tree | dc17a922c4d7334ffdefc6d0d607e9a4598fb068 /llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp | |
parent | baeea9193370deeefb19ea7602606e262fec9be6 (diff) | |
download | bcm5719-llvm-9650c95b7e55791faca4800c8f14f8325942a3b7.tar.gz bcm5719-llvm-9650c95b7e55791faca4800c8f14f8325942a3b7.zip |
[InstCombine] allow unordered preds when canonicalizing to fabs()
We have a known-never-nan value via 'nnan', so an unordered predicate
is the same as its ordered sibling.
Similar to:
rL362937
llvm-svn: 362954
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp index 808833d95ab..c6d2acac155 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp @@ -1879,7 +1879,7 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) { if (match(CondVal, m_FCmp(Pred, m_Specific(FalseVal), m_AnyZeroFP())) && match(TrueVal, m_FSub(m_PosZeroFP(), m_Specific(FalseVal))) && match(TrueVal, m_Instruction(FSub)) && FSub->hasNoNaNs() && - Pred == FCmpInst::FCMP_OLE) { + (Pred == FCmpInst::FCMP_OLE || Pred == FCmpInst::FCMP_ULE)) { Value *Fabs = Builder.CreateUnaryIntrinsic(Intrinsic::fabs, FalseVal, FSub); return replaceInstUsesWith(SI, Fabs); } @@ -1887,7 +1887,7 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) { if (match(CondVal, m_FCmp(Pred, m_Specific(TrueVal), m_AnyZeroFP())) && match(FalseVal, m_FSub(m_PosZeroFP(), m_Specific(TrueVal))) && match(FalseVal, m_Instruction(FSub)) && FSub->hasNoNaNs() && - Pred == FCmpInst::FCMP_OGT) { + (Pred == FCmpInst::FCMP_OGT || Pred == FCmpInst::FCMP_UGT)) { Value *Fabs = Builder.CreateUnaryIntrinsic(Intrinsic::fabs, TrueVal, FSub); return replaceInstUsesWith(SI, Fabs); } |