[llvm] [Evaluator] require invariant size to fully span the global (PR #179518)

Jameson Nash via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 3 12:53:42 PST 2026


================
@@ -431,10 +431,9 @@ bool Evaluator::EvaluateBlock(BasicBlock::iterator CurInst, BasicBlock *&NextBB,
           Value *PtrArg = getVal(II->getArgOperand(1));
           Value *Ptr = PtrArg->stripPointerCasts();
           if (GlobalVariable *GV = dyn_cast<GlobalVariable>(Ptr)) {
-            Type *ElemTy = GV->getValueType();
+            uint64_t MinGVSize = GV->getGlobalSize(DL);
             if (!Size->isMinusOne() &&
----------------
vtjnash wrote:

I hesitated on that question too. The LangRef doesn't really say that it is the whole object, but that `-1` means that the `Constant*` there should have been a `Value*` so nothing is really able to be known about it. If we were to update the LangRef though (or remove the parameter entirely, as done recently for lifetime), I think that would be correct.

https://github.com/llvm/llvm-project/pull/179518


More information about the llvm-commits mailing list