[PATCH] D32476: [EarlyCSE] Remove guards with conditions known to be true

Sanjoy Das via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 27 17:51:08 PDT 2017


sanjoy added inline comments.


================
Comment at: lib/Transforms/Scalar/EarlyCSE.cpp:666
+            if (isa<ConstantInt>(KnownCond) &&
+                cast<ConstantInt>(KnownCond)->isOneValue()) {
+              DEBUG(dbgs() << "EarlyCSE removing guard: " << *Inst << '\n');
----------------
You should be able to do `if (match(KnownCond, m_One()))` to make it a bit more concise, but what you have now is fine too.


https://reviews.llvm.org/D32476





More information about the llvm-commits mailing list