summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineFunctionPass.cpp
diff options
context:
space:
mode:
authorDerek Schuff <dschuff@google.com>2016-03-29 20:28:20 +0000
committerDerek Schuff <dschuff@google.com>2016-03-29 20:28:20 +0000
commit07636cd5e7e029808c98f2cf2ebae8780986d877 (patch)
treeb7c9f61d7ae62bf264fdba27eaf45f4ab72805a3 /llvm/lib/CodeGen/MachineFunctionPass.cpp
parent32071a20bc62e8992f1e0c218de8493a0c5604a7 (diff)
downloadbcm5719-llvm-07636cd5e7e029808c98f2cf2ebae8780986d877.tar.gz
bcm5719-llvm-07636cd5e7e029808c98f2cf2ebae8780986d877.zip
Add a print method to MachineFunctionProperties for better error messages
This makes check failures much easier to understand. Make it empty (but leave it in the class) for NDEBUG builds. Differential Revision: http://reviews.llvm.org/D18529 llvm-svn: 264780
Diffstat (limited to 'llvm/lib/CodeGen/MachineFunctionPass.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineFunctionPass.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/MachineFunctionPass.cpp b/llvm/lib/CodeGen/MachineFunctionPass.cpp
index bd0b11a8cb5..f6cb36e1a20 100644
--- a/llvm/lib/CodeGen/MachineFunctionPass.cpp
+++ b/llvm/lib/CodeGen/MachineFunctionPass.cpp
@@ -44,8 +44,18 @@ bool MachineFunctionPass::runOnFunction(Function &F) {
MachineFunction &MF = getAnalysis<MachineFunctionAnalysis>().getMF();
MachineFunctionProperties &MFProps = MF.getProperties();
- assert(MFProps.verifyRequiredProperties(RequiredProperties) &&
- "Properties required by the pass are not met by the function");
+#ifndef NDEBUG
+ if (!MFProps.verifyRequiredProperties(RequiredProperties)) {
+ errs() << "MachineFunctionProperties required by " << getPassName()
+ << " pass are not met by function " << F.getName() << ".\n"
+ << "Required properties: ";
+ RequiredProperties.print(errs());
+ errs() << "\nCurrent properties: ";
+ MFProps.print(errs());
+ errs() << "\n";
+ llvm_unreachable("MachineFunctionProperties check failed");
+ }
+#endif
bool RV = runOnMachineFunction(MF);
OpenPOWER on IntegriCloud