diff --git a/test/Transforms/SCCP/ipsccp-basic.ll b/test/Transforms/SCCP/ipsccp-basic.ll index 4db5c4478d3..b7db8689115 100644 --- a/test/Transforms/SCCP/ipsccp-basic.ll +++ b/test/Transforms/SCCP/ipsccp-basic.ll @@ -1,4 +1,5 @@ ; RUN: opt < %s -ipsccp -S | FileCheck %s +; RUN: opt < %s -enable-debugify -ipsccp -debugify-quiet -disable-output ;;======================== test1 diff --git a/tools/opt/Debugify.cpp b/tools/opt/Debugify.cpp index 54ff00849b0..e8437016d94 100644 --- a/tools/opt/Debugify.cpp +++ b/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 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"; }