mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-19 15:13:49 -04:00
[Debugify] Handle failure to get fragment size when checking dbg.values
It's not possible to get the fragment size of some dbg.values. Teach the
mis-sized dbg.value diagnostic to detect this scenario and bail out.
Tested with:
$ find test/Transforms -print -exec opt -debugify-each -instcombine {} \;
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335695 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -184,12 +184,15 @@ bool diagnoseMisSizedDbgValue(Module &M, DbgValueInst *DVI) {
|
||||
|
||||
Type *Ty = V->getType();
|
||||
uint64_t ValueOperandSize = getAllocSizeInBits(M, Ty);
|
||||
uint64_t DbgVarSize = *DVI->getFragmentSizeInBits();
|
||||
bool HasBadSize = Ty->isIntegerTy() ? (ValueOperandSize < DbgVarSize)
|
||||
: (ValueOperandSize != DbgVarSize);
|
||||
Optional<uint64_t> DbgVarSize = DVI->getFragmentSizeInBits();
|
||||
if (!ValueOperandSize || !DbgVarSize)
|
||||
return false;
|
||||
|
||||
bool HasBadSize = Ty->isIntegerTy() ? (ValueOperandSize < *DbgVarSize)
|
||||
: (ValueOperandSize != *DbgVarSize);
|
||||
if (HasBadSize) {
|
||||
dbg() << "ERROR: dbg.value operand has size " << ValueOperandSize
|
||||
<< ", but its variable has size " << DbgVarSize << ": ";
|
||||
<< ", but its variable has size " << *DbgVarSize << ": ";
|
||||
DVI->print(dbg());
|
||||
dbg() << "\n";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user