[all-commits] [llvm/llvm-project] 2cdc6f: Reland "[LICM] Hoist LOAD without sinking the STORE"
Djordje Todorovic via All-commits
all-commits at lists.llvm.org
Thu Dec 2 03:54:31 PST 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 2cdc6f2ca62e83fec445114fbbe6276e9ab2a7d0
https://github.com/llvm/llvm-project/commit/2cdc6f2ca62e83fec445114fbbe6276e9ab2a7d0
Author: Djordje Todorovic <djordje.todorovic at syrmia.com>
Date: 2021-12-02 (Thu, 02 Dec 2021)
Changed paths:
M llvm/include/llvm/Transforms/Utils/SSAUpdater.h
M llvm/lib/Transforms/Scalar/LICM.cpp
M llvm/lib/Transforms/Utils/SSAUpdater.cpp
M llvm/test/Transforms/InstMerge/st_sink_bugfix_22613.ll
M llvm/test/Transforms/LICM/hoist-load-without-store.ll
M llvm/test/Transforms/LICM/promote-capture.ll
M llvm/test/Transforms/LICM/scalar-promote-memmodel.ll
M llvm/test/Transforms/LICM/scalar-promote-opaque-ptrs.ll
M llvm/test/Transforms/LICM/scalar-promote.ll
Log Message:
-----------
Reland "[LICM] Hoist LOAD without sinking the STORE"
When doing load/store promotion within LICM, if we
cannot prove that it is safe to sink the store we won't
hoist the load, even though we can prove the load could
be dereferenced and moved outside the loop. This patch
implements the load promotion by moving it in the loop
preheader by inserting proper PHI in the loop. The store
is kept as is in the loop. By doing this, we avoid doing
the load from a memory location in each iteration.
Please consider this small example:
loop {
var = *ptr;
if (var) break;
*ptr= var + 1;
}
After this patch, it will be:
var0 = *ptr;
loop {
var1 = phi (var0, var2);
if (var1) break;
var2 = var1 + 1;
*ptr = var2;
}
This addresses some problems from [0].
[0] https://bugs.llvm.org/show_bug.cgi?id=51193
Differential revision: https://reviews.llvm.org/D113289
More information about the All-commits
mailing list