[llvm-commits] [llvm] r57124 - /llvm/trunk/utils/TableGen/CodeEmitterGen.cpp

Chris Lattner sabre at nondot.org
Sun Oct 5 11:31:58 PDT 2008


Author: lattner
Date: Sun Oct  5 13:31:58 2008
New Revision: 57124

URL: http://llvm.org/viewvc/llvm-project?rev=57124&view=rev
Log:
Fix shift overflow bug that would occur when a field was a full 32-bits 
in tblgen.  This is PR2827, thanks to Waldemar Knorr for tracking this
down.

Modified:
    llvm/trunk/utils/TableGen/CodeEmitterGen.cpp

Modified: llvm/trunk/utils/TableGen/CodeEmitterGen.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeEmitterGen.cpp?rev=57124&r1=57123&r2=57124&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/CodeEmitterGen.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeEmitterGen.cpp Sun Oct  5 13:31:58 2008
@@ -191,7 +191,7 @@
               gotOp = true;
             }
             
-            unsigned opMask = (1 << N) - 1;
+            unsigned opMask = ~0U >> (32-N);
             int opShift = beginVarBit - N + 1;
             opMask <<= opShift;
             opShift = beginInstBit - beginVarBit;





More information about the llvm-commits mailing list