From 0198b73769e4ff37cc122a11c3fdea575d1a2e08 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Fri, 18 May 2018 21:21:56 +0000 Subject: [InstCombine] Qualify a select pattern based transform to restrct to only min/max and ignore abs/nabs. llvm-svn: 332770 --- llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp') diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp index b4db091a439..b7735c43dd7 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp @@ -938,7 +938,7 @@ Instruction *InstCombiner::foldSPFofSPF(Instruction *Inner, if (C == A || C == B) { // MAX(MAX(A, B), B) -> MAX(A, B) // MIN(MIN(a, b), a) -> MIN(a, b) - if (SPF1 == SPF2) + if (SPF1 == SPF2 && SelectPatternResult::isMinOrMax(SPF1)) return replaceInstUsesWith(Outer, Inner); // MAX(MIN(a, b), a) -> a -- cgit v1.2.3