[PATCH] D71312: [InstCombine] X / (select C, X, -X) -> select C ? 1 : -1

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 10 17:42:07 PST 2019


craig.topper added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp:1115
 
+  // X / (select C, X, -X) -> select C ? 1 : -1
+  // (select C, X, -X) / X -> select C ? 1 : -1
----------------
Taking this even farther. Can't we do

X / (select C, A, X) -> select C, X / A, 1  


I assume if A happens to be X or -X it would continue folding on its own when the new nodes are processed in the worklist


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71312/new/

https://reviews.llvm.org/D71312





More information about the llvm-commits mailing list