-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hide returns_twice function from LLVM passes
LLVM has really bad support for returns_twice functions and can incorrectly move memory operations (both at IR and machine code level) due to missing control flow edge. By outlining the exception body, we can hide these functions from LLVM completely (they only exist in C code) and prevent all miscompilation. This also makes it much easier to check the correctness of heap to stack allocation optimization especially since not all memory operation intrinsics in LLVM has a volatile counterpart. This will obviously inhibit some valid optimizations too. These are mainly forwarding of memory operations from the caller to the exception body (since the other way around is almost always invalid) and can be improved with some simple IPO. This also makes it unnecessary to mark any memory operations on the stack with `volatile` this should also improve optimization in certain cases. Since we are scanning all the instructions in the outlined code anyway this also includes a simple optimization to delete exception frame that can't trigger. This implements a tweaked version of https://discourse.julialang.org/t/avoid-llvm-setjmp-bug/1140 Fix #17288
- Loading branch information
Showing
15 changed files
with
1,120 additions
and
456 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.