1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02: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 {} \;

llvm-svn: 335695
This commit is contained in:
Vedant Kumar 2018-06-27 00:47:52 +00:00
parent be4feb18ce
commit 8c93d49cb8
2 changed files with 8 additions and 4 deletions

View File

@ -1,4 +1,5 @@
; RUN: opt < %s -ipsccp -S | FileCheck %s
; RUN: opt < %s -enable-debugify -ipsccp -debugify-quiet -disable-output
;;======================== test1

View File

@ -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";
}