aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp
diff options
context:
space:
mode:
authorPavel Skripkin <paskripkin@gmail.com>2025-08-14 10:23:03 +0300
committerGitHub <noreply@github.com>2025-08-14 10:23:03 +0300
commit30144226a4ea916341c37759d93dc2b32502efa1 (patch)
treefa48065ddfb44378a247ea4ac826218b20b4bc1c /lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp
parentf92afe7171fcda7b1b69fd428925dd7655021226 (diff)
downloadllvm-30144226a4ea916341c37759d93dc2b32502efa1.zip
llvm-30144226a4ea916341c37759d93dc2b32502efa1.tar.gz
llvm-30144226a4ea916341c37759d93dc2b32502efa1.tar.bz2
[llvm] [InstCombine] fold "icmp eq (X + (V - 1)) & -V, X" to "icmp eq (and X, V - 1), 0" (#152851)
This fold optimizes ```llvm define i1 @src(i32 %num, i32 %val) { %mask = add i32 %val, -1 %neg = sub nsw i32 0, %val %num.biased = add i32 %num, %mask %_2.sroa.0.0 = and i32 %num.biased, %neg %_0 = icmp eq i32 %_2.sroa.0.0, %num ret i1 %_0 } ``` to ```llvm define i1 @tgt(i32 %num, i32 %val) { %mask = add i32 %val, -1 %tmp = and i32 %num, %mask %ret = icmp eq i32 %tmp, 0 ret i1 %ret } ``` For power-of-two `val`. Observed in real life for following code ```rust pub fn is_aligned(num: usize) -> bool { num.next_multiple_of(1 << 12) == num } ``` which verifies that num is aligned to 4096. Alive2 proof https://alive2.llvm.org/ce/z/QisECm
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp')
0 files changed, 0 insertions, 0 deletions