[llvm] [FuncAttrs] Relax norecurse attribute inference (PR #139943)

Usha Gupta via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 19 04:07:30 PDT 2025


usha1830 wrote:

Thanks @david-arm for pointing out a case in which `norecurse` gets added incorrectly during pre-LTO with my last commit.

```
int main() {
  ... setup malloc_hook callback to boo() ...
  return foo();
}

static void *
boo (size_t size, const void *caller)
 // .. call malloc and does other custom processing before/after malloc
  void *p = foo();
  return p != null;
}

static void *foo() { // address not taken, has local linkage, number of SCC nodes = 1
  return bar();
}
-> pre-lto gets marked as norecurse
-> post-lto would not be marked as norecurse due to boo's address taken

void *bar() {
  return malloc(10);
}
```

Latest commit fixes this.

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


More information about the llvm-commits mailing list