aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Value.cpp
diff options
context:
space:
mode:
authorQuentin Colombet <qcolombet@apple.com>2021-01-11 16:31:40 -0800
committerQuentin Colombet <qcolombet@apple.com>2021-01-11 18:02:49 -0800
commit905623b64df0c865d4dddc4a60aff9751fbaa0e0 (patch)
treedafd67cee8d1ef2e38a368aa93edcb89316f43ef /llvm/lib/IR/Value.cpp
parent9f8b25769efa409ffc3b85f1c8043d2fcb4f185e (diff)
downloadllvm-905623b64df0c865d4dddc4a60aff9751fbaa0e0.zip
llvm-905623b64df0c865d4dddc4a60aff9751fbaa0e0.tar.gz
llvm-905623b64df0c865d4dddc4a60aff9751fbaa0e0.tar.bz2
[NFC][LICM] Minor improvements to debug output
Added a utility function in Value class to print block name and use block labels for unnamed blocks. Changed LICM to call this function in its debug output. Patch by Xiaoqing Wu <xiaoqing_wu@apple.com> Differential Revision: https://reviews.llvm.org/D93577
Diffstat (limited to 'llvm/lib/IR/Value.cpp')
-rw-r--r--llvm/lib/IR/Value.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/IR/Value.cpp b/llvm/lib/IR/Value.cpp
index 51a84b6..572f37a 100644
--- a/llvm/lib/IR/Value.cpp
+++ b/llvm/lib/IR/Value.cpp
@@ -430,6 +430,18 @@ void Value::takeName(Value *V) {
ST->reinsertValue(this);
}
+#ifndef NDEBUG
+std::string Value::getNameOrAsOperand() const {
+ if (!getName().empty())
+ return std::string(getName());
+
+ std::string BBName;
+ raw_string_ostream OS(BBName);
+ printAsOperand(OS, false);
+ return OS.str();
+}
+#endif
+
void Value::assertModuleIsMaterializedImpl() const {
#ifndef NDEBUG
const GlobalValue *GV = dyn_cast<GlobalValue>(this);