Commit 98dc35b9 authored by Camillo Bruni's avatar Camillo Bruni Committed by Commit Bot

[CSA] Improve error message with non-bound or unused labels

Change-Id: Ic2c4d90dbf91b43e6e4d9cba580385bfd61802ca
Reviewed-on: https://chromium-review.googlesource.com/518044Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45621}
parent f87271cc
......@@ -405,9 +405,17 @@ Node* RawMachineAssembler::MakeNode(const Operator* op, int input_count,
}
RawMachineLabel::~RawMachineLabel() {
// If this DCHECK fails, it means that the label has been bound but it's not
// used, or the opposite. This would cause the register allocator to crash.
DCHECK_EQ(bound_, used_);
#if DEBUG
if (bound_ == used_) return;
std::stringstream str;
if (bound_) {
str << "A label has been bound but it's not used."
<< "\n# label: " << *block_;
} else {
str << "A label has been used but it's not bound.";
}
FATAL(str.str().c_str());
#endif // DEBUG
}
} // namespace compiler
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment