LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 27117 - LLVM generates unreachable call stack adjustments after noreturn functions when the frame is not reserved
Summary: LLVM generates unreachable call stack adjustments after noreturn functions wh...
Status: RESOLVED FIXED
Alias: None
Product: libraries
Classification: Unclassified
Component: Common Code Generator Code (show other bugs)
Version: trunk
Hardware: PC Windows NT
: P normal
Assignee: Unassigned LLVM Bugs
URL:
Keywords:
Depends on:
Blocks: 26299
  Show dependency tree
 
Reported: 2016-03-29 13:26 PDT by Reid Kleckner
Modified: 2016-05-20 10:52 PDT (History)
3 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Reid Kleckner 2016-03-29 13:26:35 PDT
Consider:

__declspec(noreturn) void crash(void *);
void g(void*);
void f(int c) {
  void *p = _alloca(c);
  if (c)
    crash(p);
  g(p);
}

Here is the call to 'crash':
.LBB0_1:                                # %if.then
        callq   "?crash@@YAXPEAX@Z"
        addq    $32, %rsp
        ud2

The ADD RSP instruction is dead. On Windows, it is very common to not have a reserved call frame because of inalloca.

Maybe the right fix here is to teach MI more about noreturn functions so we can do more general DCE after them. It would also help us get rid of TrapOnUnreachable in favor of inserting int3 after all noreturn calls.
Comment 1 Reid Kleckner 2016-03-29 13:27:53 PDT
This is worth doing because it comes up on every assert-like construct.
Comment 2 Hans Wennborg 2016-05-20 10:52:54 PDT
r270109