Index: src/IceRegAlloc.cpp |
diff --git a/src/IceRegAlloc.cpp b/src/IceRegAlloc.cpp |
index e7538525c1337f91abe73b03a0846c082c515f23..53aa91b49d2cad236a5acd616536ab284ee9823f 100644 |
--- a/src/IceRegAlloc.cpp |
+++ b/src/IceRegAlloc.cpp |
@@ -23,6 +23,8 @@ |
#include "IceOperand.h" |
#include "IceTargetLowering.h" |
+#include "llvm/Support/Format.h" |
+ |
namespace Ice { |
namespace { |
@@ -70,10 +72,13 @@ void dumpLiveRange(const Variable *Var, const Cfg *Func) { |
if (!BuildDefs::dump()) |
return; |
Ostream &Str = Func->getContext()->getStrDump(); |
- char buf[30]; |
- snprintf(buf, llvm::array_lengthof(buf), "%2u", |
- unsigned(Var->getRegNumTmp())); |
- Str << "R=" << buf << " V="; |
+ Str << "R="; |
+ if (Var->hasRegTmp()) { |
+ Str << llvm::format("%2d", Var->getRegNumTmp()); |
+ } else { |
+ Str << "NA"; |
+ } |
+ Str << " V="; |
Var->dump(Func); |
Str << " Range=" << Var->getLiveRange(); |
} |