[PATCH] D45986: [AggressiveInstCombine] convert a chain of 'or-shift' bits into masked compare

Krzysztof Parzyszek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 1 07:05:31 PDT 2018


kparzysz accepted this revision.
kparzysz added a comment.
This revision is now accepted and ready to land.

I think we should recognize as much as we can out of the common idioms, and this is one of them.  Looks good to me.



================
Comment at: lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp:76
+  uint64_t BitIndex = 0;
+  if (!match(V, m_LShr(m_Value(Candidate), m_ConstantInt(BitIndex))))
+    Candidate = V;
----------------
You could also match arithmetic shifts-right as long as the shift amount does not move the sign bit into the 0th position.  It's not necessary for this patch though.


https://reviews.llvm.org/D45986





More information about the llvm-commits mailing list