[llvm] [IR] Add assertions for unchecked getAsInteger() calls in atrib merging (PR #194713)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 29 00:58:27 PDT 2026


================
@@ -2686,9 +2686,10 @@ adjustCallerStackProbeSize(Function &Caller, const Function &Callee) {
   if (CalleeAttr.isValid()) {
     Attribute CallerAttr = Caller.getFnAttribute("stack-probe-size");
     if (CallerAttr.isValid()) {
-      uint64_t CallerStackProbeSize, CalleeStackProbeSize;
-      CallerAttr.getValueAsString().getAsInteger(0, CallerStackProbeSize);
-      CalleeAttr.getValueAsString().getAsInteger(0, CalleeStackProbeSize);
+      uint64_t CallerStackProbeSize =
+          Caller.getFnAttributeAsParsedInteger("stack-probe-size");
----------------
nikic wrote:

It's a bit unfortunate that we have to go back to the function here and fetch the attribute again. I wonder whether it would make sense to add this API to Attribute as well? That is getValueAsParsedInteger()?

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


More information about the llvm-commits mailing list