[llvm-commits] [llvm] r135786 - /llvm/trunk/tools/llvm-objdump/MCFunction.cpp

Benjamin Kramer benny.kra at googlemail.com
Fri Jul 22 11:35:09 PDT 2011


Author: d0k
Date: Fri Jul 22 13:35:09 2011
New Revision: 135786

URL: http://llvm.org/viewvc/llvm-project?rev=135786&view=rev
Log:
llvm-objdump: Skip branches that leave the current function.

In "normal" code these only happen when disassembling data, so we
won't lose anything if we just drop them.

Modified:
    llvm/trunk/tools/llvm-objdump/MCFunction.cpp

Modified: llvm/trunk/tools/llvm-objdump/MCFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/MCFunction.cpp?rev=135786&r1=135785&r2=135786&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/MCFunction.cpp (original)
+++ llvm/trunk/tools/llvm-objdump/MCFunction.cpp Fri Jul 22 13:35:09 2011
@@ -46,7 +46,10 @@
           int64_t Imm = Inst.getOperand(0).getImm();
           // FIXME: Distinguish relocations from nop jumps.
           if (Imm != 0) {
-            assert(Index+Imm+Size < End && "Branch out of function.");
+            if (Index+Imm+Size >= End) {
+              Instructions.push_back(MCDecodedInst(Index, Size, Inst));
+              continue; // Skip branches that leave the function.
+            }
             Splits.insert(Index+Imm+Size);
           }
         }





More information about the llvm-commits mailing list