[PATCH] D47037: [ValueTracking][EarlyCSE][InstCombine] Improve EarlyCSE of some absolute value cases.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 18 11:36:10 PDT 2018


craig.topper added inline comments.


================
Comment at: lib/Transforms/InstCombine/InstCombineSelect.cpp:941-942
     // MIN(MIN(a, b), a) -> MIN(a, b)
-    if (SPF1 == SPF2)
+    if (SelectPatternResult::isMinOrMax(SPF1) && SPF1 == SPF2)
       return replaceInstUsesWith(Outer, Inner);
 
----------------
spatel wrote:
> Can you check that in as a preliminary cleanup? I think this patch should be just about EarlyCSE.
> 
> Ideally, we'd clean this up more - put the min/max predicate over the subsequent 3 transforms too and simplify that code (can FP min/max get in here?). 
> 
> Even better would be to move these folds to instsimplify. We're not creating new values here.
I don't see any reason FP min/max can't get here.

What simplification does the min/max check provide for the other 3 transforms?


https://reviews.llvm.org/D47037





More information about the llvm-commits mailing list