-
Notifications
You must be signed in to change notification settings - Fork 11.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GuardWidening] Freeze the introduced use.
Guard widening optimization is able to move the condition from one guard to the previous one. As a result if the condition is poison and orginal second guard is never executed but the first one does, we introduce undefined behavior which was not observed in original program. To resolve the issue we must freeze the condition we are moving. However optimization itself does not know how to work with freeze. Additionally optimization is written in incremental way. For example we have three guards G1(base + 8 < L) G2(base + 16 < L) G3(base + 24 < L) On the first step GW will combine G1 and G2 as G1(base + 8 < L && freeze(base + 16 < L)) G2(true) G3(base + 24 < L) while combining G1 and G3 base appears to be different. To keep optimization enabled after freezing the moving condition, the freeze instruction is pushed as much as possible and later all uses of freezed values are replaced with frozen version. This is similar what instruction combining does but more aggressevely. Reviewed By: mkazantsev Differential Revision: https://reviews.llvm.org/D146699
- Loading branch information
Serguei Katkov
committed
Mar 29, 2023
1 parent
fba2a7c
commit f4b2360
Showing
13 changed files
with
334 additions
and
125 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
Oops, something went wrong.