[PATCH] D71158: [NFC][InstSimplify] Refactoring ThreadCmpOverSelect function

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 11 06:45:51 PST 2019


spatel added inline comments.


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:147
+  if (SimplifiedCmp == Cond) {
+    // It not only simplified, it simplified to the select condition.
+    SimplifiedCmp = TrueOrFalse;
----------------
xbolva00 wrote:
> It would be great to improve these original comments a bit.
Agree - there's no context for what we're doing at this point. IIUC, the original pattern is:
cmp Pred (select Cond, TV, FV), RHS

And we're checking if this simplifies:
cmp Pred TV/FV, RHS

What happens after that is complicated...it might help to add an example?


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:144
+                                 const SimplifyQuery &Q, unsigned MaxRecurse,
+                                 Value *TrueOrFalse) {
+  Value *SimplifiedCmp = SimplifyCmpInst(Pred, LHS, RHS, Q, MaxRecurse);
----------------
Should the type of the last arg be Constant?
Constant *TrueOrFalse


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71158





More information about the llvm-commits mailing list