Have ConstantExprs upgrade opcodes the same way as instructions.
authorReid Spencer <rspencer@reidspencer.com>
Sat, 18 Nov 2006 04:37:19 +0000 (04:37 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Sat, 18 Nov 2006 04:37:19 +0000 (04:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31841 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Bytecode/Reader/Reader.cpp

index 084b4fcade4dd2f785177729d1f3148326c8a22d..86e011eb0aa5d84eb4c204342668bfea3966a372 100644 (file)
@@ -1506,9 +1506,19 @@ inline unsigned BytecodeReader::upgradeCEOpcodes(
       Opcode = 10; // Div
     else if (Opcode >=13 && Opcode <= 15) // URem through FRem
       Opcode = 11; // Rem
-    else if (Opcode > 15)  // Everything above FRem
+    else if (Opcode >= 16 && Opcode <= 35)  // And through Shr
       // Adjust for new instruction codes
       Opcode -= 4;
+    else if (Opcode >= 36 && Opcode <= 42) // Everything after Select
+      // In vers 6 bytecode we eliminated the placeholders for the obsolete
+      // VAARG and VANEXT instructions. Consequently those two slots were
+      // filled starting with Select (36) which was 34. So now we only need
+      // to subtract two. This circumvents hitting opcodes 32 and 33
+      Opcode -= 2;
+    else {   // Opcode < 10 or > 42
+      // No upgrade necessary.
+      return 0;
+    }
   }
 
   switch (Opcode) {