[PATCH] D158743: [Verifier] Sanity check alloca size against DILocalVariable fragment size

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 24 11:09:44 PDT 2023


aprantl accepted this revision.
aprantl added inline comments.
This revision is now accepted and ready to land.


================
Comment at: llvm/lib/IR/Verifier.cpp:6290
+          (Expr->getNumElements() == 0 ||
+           Expr->expr_op_begin()->getOp() == dwarf::DW_OP_LLVM_fragment)) {
+        CheckDI(*FragSize <= AllocSize->getFixedValue(),
----------------
aprantl wrote:
> nikic wrote:
> > This is my attempt to only handle empty DIExpression or DW_OP_LLVM_fragment, but not things like DW_OP_deref. Is there some cleaner way to check this?
> Yeah, you need to check that the expression directly points into the alloca and isn't the result computation that uses the contents of the alloca as an input.
!isComplex() might do what you want.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158743/new/

https://reviews.llvm.org/D158743



More information about the llvm-commits mailing list