Hacker News new | ask | show | jobs
by woodruffw 1661 days ago
AFAIK, LLVM doesn’t actually require those intrinsics for VLAs — the `alloca` instruction can take a non-immediate for the stack object size. I can’t remember off the top of my head whether I’ve seen LLVM consistently include the intrinsics as well.

As for the dominator case: it’s possible that it does need them then. But for a really trivial VLA (like at the level of the function’s frame) it shouldn’t.

1 comments

The only case I recall seeing @llvm.{stacksave,stackrestore} use was when LLVM inlined a function with a non-entry-block-alloca into another function, where the intrinsics got added immediately before/after what used to be the function call.