[PATCH] D115530: [GlobalOpt][Evaluator] Rewrite global ctor evaluation (fixes PR51879)
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 10 11:45:53 PST 2021
nikic marked an inline comment as done.
nikic added inline comments.
================
Comment at: llvm/lib/Transforms/Utils/Evaluator.cpp:189
+ Type *MVType = MV->getType();
+ MV->~MutableValue();
+ if (Ty->isIntegerTy() && MVType->isPointerTy())
----------------
jroelofs wrote:
> The lifetime of `MV` (or even possibly `this`) ends here, and I think that makes it UB to write to `Val` below. Maybe the dtor's body needs to be outlined & called here explicitly instead of the dtor itself?
Not sure what the exact rules here are, but it was definitely dubious... I've added a clear() method now, which is called here and in the dtor.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D115530/new/
https://reviews.llvm.org/D115530
More information about the llvm-commits
mailing list