aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorSerguei Katkov <serguei.katkov@azul.com>2023-03-23 11:05:10 +0700
committerSerguei Katkov <serguei.katkov@azul.com>2023-03-29 16:30:43 +0700
commitf4b2360cecd4c92e85bccb1443f2ef425fc6a77b (patch)
tree91d55cf85daa3433d0879965952692cb03d434b4 /clang/lib/Frontend/CompilerInvocation.cpp
parentfba2a7c6958b6a649d0f96a7e76b384cf34e6543 (diff)
downloadllvm-f4b2360cecd4c92e85bccb1443f2ef425fc6a77b.zip
llvm-f4b2360cecd4c92e85bccb1443f2ef425fc6a77b.tar.gz
llvm-f4b2360cecd4c92e85bccb1443f2ef425fc6a77b.tar.bz2
[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
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions