diff options
author | Chris Lattner <sabre@nondot.org> | 2007-02-05 21:23:52 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-02-05 21:23:52 +0000 |
commit | b6a24bfa9550e5561da3091f7e5132575bf5a19e (patch) | |
tree | 7fd8466feec13a0de9f68fee74d6e8dbfeb2185c /lib/CodeGen | |
parent | 688b0490e22eb67623f5aaa24406209be74efcb2 (diff) |
Fix PR1178
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33924 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/AsmPrinter.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/CodeGen/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter.cpp index 37fb51f1c5..9f867a8489 100644 --- a/lib/CodeGen/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter.cpp @@ -839,9 +839,19 @@ void AsmPrinter::PrintSpecial(const MachineInstr *MI, const char *Code) { } else if (!strcmp(Code, "uid")) { // Assign a unique ID to this machine instruction. static const MachineInstr *LastMI = 0; + static const Function *F = 0; static unsigned Counter = 0U-1; + + // Comparing the address of MI isn't sufficient, because machineinstrs may + // be allocated to the same address across functions. + const Function *ThisF = MI->getParent()->getParent()->getFunction(); + // If this is a new machine instruction, bump the counter. - if (LastMI != MI) { ++Counter; LastMI = MI; } + if (LastMI != MI || F != ThisF) { + ++Counter; + LastMI = MI; + ThisF = F; + } O << Counter; } else { cerr << "Unknown special formatter '" << Code |