[llvm-commits] [llvm] r141829 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Eli Friedman eli.friedman at gmail.com
Wed Oct 12 15:46:45 PDT 2011


Author: efriedma
Date: Wed Oct 12 17:46:45 2011
New Revision: 141829

URL: http://llvm.org/viewvc/llvm-project?rev=141829&view=rev
Log:
Use a utility from MathExtras to clarify a check and avoid undefined behavior.  Based on patch by Ahmed Charles.


Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=141829&r1=141828&r2=141829&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Wed Oct 12 17:46:45 2011
@@ -1679,7 +1679,7 @@
     UsePtrType = true;
   else {
     for (unsigned i = 0, e = B.Cases.size(); i != e; ++i)
-      if ((uint64_t)((int64_t)B.Cases[i].Mask >> VT.getSizeInBits()) + 1 >= 2) {
+      if (!isUIntN(VT.getSizeInBits(), B.Cases[i].Mask)) {
         // Switch table case range are encoded into series of masks.
         // Just use pointer type, it's guaranteed to fit.
         UsePtrType = true;





More information about the llvm-commits mailing list