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

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 18 07:17:09 PDT 2018


spatel 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);
 
----------------
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.


https://reviews.llvm.org/D47037





More information about the llvm-commits mailing list