[PATCH] D28337: [InstSimplify] if the condition of a select is known, eliminate the select

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 9 12:27:45 PST 2017


efriedma added a comment.

This seems like a dangerous direction, in the sense that it could make instsimplify very expensive... I mean, if we didn't care about compile-time cost, we could call computeKnownBits on all the operands for every call into instsimplify, and hope something simplifies.  Could we put this sort of transform somewhere it isn't called so frequently?



================
Comment at: lib/Analysis/InstructionSimplify.cpp:3712
+  // If we can compute the condition, there's no need for a select.
+  if (CondVal->getType()->getPrimitiveSizeInBits() == 1) {
+    APInt KnownOne(1, 0), KnownZero(1, 0);
----------------
There's probably a more straightforward way to check whether the condition is a vector type.


https://reviews.llvm.org/D28337





More information about the llvm-commits mailing list