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

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 20 07:49:05 PDT 2018


spatel added inline comments.


================
Comment at: lib/Analysis/ValueTracking.cpp:4574-4576
+      // Set RHS to the negate operand. LHS was assigned to CmpLHS earlier.
+      RHS = (CmpLHS == TrueVal) ? FalseVal : TrueVal;
 
----------------
This new ABS/NABS behavior should be documented in the header comment.


================
Comment at: lib/Transforms/Scalar/EarlyCSE.cpp:164-167
+  if (SPF == SPF_ABS || SPF == SPF_NABS) {
+    // ABS/NABS always puts the input in A and its negation in B.
+    return hash_combine(Inst->getOpcode(), SPF, A, B);
+  }
----------------
This is dead code unless we remove the ABS/NABS checks above here?


https://reviews.llvm.org/D47037





More information about the llvm-commits mailing list