[llvm] r335695 - [Debugify] Handle failure to get fragment size when checking dbg.values
Vedant Kumar via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 26 17:47:52 PDT 2018
Author: vedantk
Date: Tue Jun 26 17:47:52 2018
New Revision: 335695
URL: http://llvm.org/viewvc/llvm-project?rev=335695&view=rev
Log:
[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 {} \;
Modified:
llvm/trunk/test/Transforms/SCCP/ipsccp-basic.ll
llvm/trunk/tools/opt/Debugify.cpp
Modified: llvm/trunk/test/Transforms/SCCP/ipsccp-basic.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SCCP/ipsccp-basic.ll?rev=335695&r1=335694&r2=335695&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/SCCP/ipsccp-basic.ll (original)
+++ llvm/trunk/test/Transforms/SCCP/ipsccp-basic.ll Tue Jun 26 17:47:52 2018
@@ -1,4 +1,5 @@
; RUN: opt < %s -ipsccp -S | FileCheck %s
+; RUN: opt < %s -enable-debugify -ipsccp -debugify-quiet -disable-output
;;======================== test1
Modified: llvm/trunk/tools/opt/Debugify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/Debugify.cpp?rev=335695&r1=335694&r2=335695&view=diff
==============================================================================
--- llvm/trunk/tools/opt/Debugify.cpp (original)
+++ llvm/trunk/tools/opt/Debugify.cpp Tue Jun 26 17:47:52 2018
@@ -184,12 +184,15 @@ bool diagnoseMisSizedDbgValue(Module &M,
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";
}
More information about the llvm-commits
mailing list