[PATCH] D60504: NFC: Improve pattern matching in computeKnownBitsFromAssume.

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 10 06:07:54 PDT 2019


spatel added a comment.

Seems like a good micro-optimization while actually improving readability slightly. Do you have any performance numbers for this change? It would be good to note those here and in the commit message.



================
Comment at: lib/Analysis/ValueTracking.cpp:619-620
 
+    ICmpInst *Arg = dyn_cast<ICmpInst>(I->getArgOperand(0));
+    if (!Arg)
+      continue;
----------------
IMO, it would make things a bit clearer to name this "Cmp" instead of recycling "Arg" as the name. Then use that name throughout the later code.


================
Comment at: lib/Analysis/ValueTracking.cpp:631
+      if (match(Arg, m_c_ICmp(Pred, m_V, m_Value(A))) &&
+          Pred == ICmpInst::ICMP_EQ && isValidAssumeForContext(I, Q.CxtI, Q.DT)) {
+        KnownBits RHSKnown(BitWidth);
----------------
Here and later, please remove the duplicated check of the predicate value.


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

https://reviews.llvm.org/D60504





More information about the llvm-commits mailing list