diff options
author | Kazu Hirata <kazu@google.com> | 2023-03-06 10:18:57 -0800 |
---|---|---|
committer | Kazu Hirata <kazu@google.com> | 2023-03-06 10:18:57 -0800 |
commit | a21a7ddf5ad1f34874cddb4d10cbd40b8ce1bef8 (patch) | |
tree | a97c0826fd7339eb2ac7913b07e22a225c2fbff1 /lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp | |
parent | 0e2b9672827032bb7871bfec091ff7b098c2dd88 (diff) | |
download | llvm-a21a7ddf5ad1f34874cddb4d10cbd40b8ce1bef8.zip llvm-a21a7ddf5ad1f34874cddb4d10cbd40b8ce1bef8.tar.gz llvm-a21a7ddf5ad1f34874cddb4d10cbd40b8ce1bef8.tar.bz2 |
[X86] Optimize umax(X,1) (NFC)
Without this patch:
%cond = call i32 @llvm.umax.i32(i32 %X, i32 1)
is compiled as:
83 ff 02 cmp $0x2,%edi
b8 01 00 00 00 mov $0x1,%eax
0f 43 c7 cmovae %edi,%eax
With this patch, the compiler generates:
89 f8 mov %edi,%eax
83 ff 01 cmp $0x1,%edi
83 d0 00 adc $0x0,%eax
saving 3 bytes. We should be able to save 5 bytes in larger functions
where the mov is unnecessary.
This patch converts the specific cmov pattern to cmp $1 followed by
adc $0.
This patch partially fixes:
https://github.com/llvm/llvm-project/issues/60374
The LLVM IR optimizer is yet to canonicalize max expressions to
actual @llvm.umax.
Differential Revision: https://reviews.llvm.org/D144451
Diffstat (limited to 'lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp')
0 files changed, 0 insertions, 0 deletions