mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-05 18:49:06 +00:00
[globalisel] Stop requiring -debug/-debug-only=registerbankinfo for assertions.
Summary: I've noticed that these assertions don't trigger when the condition is false. The problem is that the DEBUG(x) macro only executes x when the pass is emitting debug output via the -debug and -debug-only=registerbankinfo command line arguments. Debug builds should always execute the assertions so use '#ifndef NDEBUG' instead. Also removed an assertion that is only true the first time it's tested. <Target>RegisterBankInfo's constructor will re-use register banks causing them to be valid on subsequent tests. That assertion will fail on the first test too in the near future. Reviewers: t.p.northover, ab, rovka, qcolombet Subscribers: dberris, llvm-commits, kristof.beyls Differential Revision: https://reviews.llvm.org/D28358 llvm-svn: 291235
This commit is contained in:
parent
f29ec731bd
commit
a949cf108b
@ -55,11 +55,10 @@ const unsigned RegisterBankInfo::InvalidMappingID = UINT_MAX - 1;
|
||||
RegisterBankInfo::RegisterBankInfo(RegisterBank **RegBanks,
|
||||
unsigned NumRegBanks)
|
||||
: RegBanks(RegBanks), NumRegBanks(NumRegBanks) {
|
||||
DEBUG(for (unsigned Idx = 0, End = getNumRegBanks(); Idx != End; ++Idx) {
|
||||
#ifndef NDEBUG
|
||||
for (unsigned Idx = 0, End = getNumRegBanks(); Idx != End; ++Idx)
|
||||
assert(RegBanks[Idx] != nullptr && "Invalid RegisterBank");
|
||||
assert(!RegBanks[Idx]->isValid() &&
|
||||
"RegisterBank should be invalid before initialization");
|
||||
});
|
||||
#endif // NDEBUG
|
||||
}
|
||||
|
||||
RegisterBankInfo::~RegisterBankInfo() {
|
||||
@ -70,13 +69,15 @@ RegisterBankInfo::~RegisterBankInfo() {
|
||||
}
|
||||
|
||||
bool RegisterBankInfo::verify(const TargetRegisterInfo &TRI) const {
|
||||
DEBUG(for (unsigned Idx = 0, End = getNumRegBanks(); Idx != End; ++Idx) {
|
||||
#ifndef NDEBUG
|
||||
for (unsigned Idx = 0, End = getNumRegBanks(); Idx != End; ++Idx) {
|
||||
const RegisterBank &RegBank = getRegBank(Idx);
|
||||
assert(Idx == RegBank.getID() &&
|
||||
"ID does not match the index in the array");
|
||||
dbgs() << "Verify " << RegBank << '\n';
|
||||
assert(RegBank.verify(TRI) && "RegBank is invalid");
|
||||
});
|
||||
}
|
||||
#endif // NDEBUG
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user