[PATCH] D85969: [SCEV] Model (xor (shl x, C), (-1 << C)) as (shl (xor x, -1), C)

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 22 14:06:53 PDT 2020


lebedev.ri requested changes to this revision.
lebedev.ri added a comment.
This revision now requires changes to proceed.

Modelling this in SCEV is totally justifiable even if InstCombine knows how to fix the pattern, 
iff having this complexity actually helps. E.g. InstCombine has one-use check, so it won't fix everything.

To find that out, add a `STATISTIC()` and prove that the code actually fires on some codebase.

Marking as reviewed for now.



================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:6229-6230
+              const SCEV *NotXSCEV = getNotSCEV(getSCEV(LBO->getOperand(0)));
+              if (auto *SCEV = getShlByConstantExpr(NotXSCEV, SA, Flags))
+                return SCEV;
+            }
----------------
Add statistic here


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85969



More information about the llvm-commits mailing list