summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Verifier.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-03-14 20:19:36 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-03-14 20:19:36 +0000
commitd6d70e753dd6061d5796937b1e05fbe54f4692f8 (patch)
treeda5e5b5de4f1d6aad38b138b36e6b5ce049e7a84 /llvm/lib/IR/Verifier.cpp
parent096b1da29d21cda6c8950e477010777019ed0e88 (diff)
downloadbcm5719-llvm-d6d70e753dd6061d5796937b1e05fbe54f4692f8.tar.gz
bcm5719-llvm-d6d70e753dd6061d5796937b1e05fbe54f4692f8.zip
IR: Make Metadata::print() reliable and useful
Replumb the `AsmWriter` so that `Metadata::print()` is generally useful. (Similarly change `Metadata::printAsOperand()`.) - `SlotTracker` now has a mode where all metadata will be correctly numbered when initializing a `Module`. Normally, `Metadata` only referenced from within `Function`s gets numbered when the `Function` is incorporated. - `Metadata::print()` and `Metadata::printAsOperand()` (and `Metadata::dump()`) now take an optional `Module` argument. When provided, `SlotTracker` is initialized with the new mode, and the numbering will be complete and consistent for all calls to `print()`. - `Value::print()` uses the new `SlotTracker` mode when printing intrinsics with `MDNode` operands, `MetadataAsValue` operands, or the bodies of functions. Thus, metadata numbering will be consistent between calls to `Metadata::print()` and `Value::print()`. - `Metadata::print()` (and `Metadata::dump()`) now print the full definition of `MDNode`s: !5 = !{!6, !"abc", !7} This matches behaviour for `Value::print()`, which includes the name of instructions. - Updated call sites in `Verifier` to call `print()` instead of `printAsOperand()`. All this, so that `Verifier` can print out useful failure messages that involve `Metadata` for PR22777. Note that `Metadata::printAsOperand()` previously took an optional `bool` and `Module` operand. The former was cargo-culted from `Value::printAsOperand()` and wasn't doing anything useful. The latter didn't give consistent results (without the new `SlotTracker` mode). llvm-svn: 232275
Diffstat (limited to 'llvm/lib/IR/Verifier.cpp')
-rw-r--r--llvm/lib/IR/Verifier.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 85251551f99..6173adfe9d2 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -106,7 +106,7 @@ private:
void Write(const Metadata *MD) {
if (!MD)
return;
- MD->printAsOperand(OS, true, M);
+ MD->print(OS, M);
OS << '\n';
}
OpenPOWER on IntegriCloud