diff options
| author | Vedant Kumar <vsk@apple.com> | 2018-06-27 00:47:52 +0000 |
|---|---|---|
| committer | Vedant Kumar <vsk@apple.com> | 2018-06-27 00:47:52 +0000 |
| commit | d13536e9f3e196b0fe133387d14c94a4ac0a51db (patch) | |
| tree | 5722a091ea91098679e5c95a5ca7d89296dd6613 /llvm/tools/opt | |
| parent | 33aba0eb4c7e582577355659a593eef1ddcefee8 (diff) | |
| download | bcm5719-llvm-d13536e9f3e196b0fe133387d14c94a4ac0a51db.tar.gz bcm5719-llvm-d13536e9f3e196b0fe133387d14c94a4ac0a51db.zip | |
[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
Diffstat (limited to 'llvm/tools/opt')
| -rw-r--r-- | llvm/tools/opt/Debugify.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/llvm/tools/opt/Debugify.cpp b/llvm/tools/opt/Debugify.cpp index 54ff00849b0..e8437016d94 100644 --- a/llvm/tools/opt/Debugify.cpp +++ b/llvm/tools/opt/Debugify.cpp @@ -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"; } |

