summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-02-05 21:23:52 +0000
committerChris Lattner <sabre@nondot.org>2007-02-05 21:23:52 +0000
commita9428c4f9de53b8a9c956d2e5843c3a4dde6993e (patch)
treeab82c0d3ad45d4e4b649d106dcf83ebd9e30ccb1 /llvm/lib/CodeGen/AsmPrinter.cpp
parent4d2770d8891f2a9a1e3ae81612a95a57983bab65 (diff)
downloadbcm5719-llvm-a9428c4f9de53b8a9c956d2e5843c3a4dde6993e.tar.gz
bcm5719-llvm-a9428c4f9de53b8a9c956d2e5843c3a4dde6993e.zip
Fix PR1178
llvm-svn: 33924
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter.cpp
index 37fb51f1c56..9f867a8489a 100644
--- a/llvm/lib/CodeGen/AsmPrinter.cpp
+++ b/llvm/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
OpenPOWER on IntegriCloud