diff options
author | brendaso1 <119626341+brendaso1@users.noreply.github.com> | 2024-01-03 13:49:05 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-03 13:49:05 +0800 |
commit | 923f6ac018e3dd1c86bd4cee05e95680962e1446 (patch) | |
tree | 3eabfae217b87e454e8e5690f56c5e22ed0081e9 /llvm/lib/Object/WasmObjectFile.cpp | |
parent | ed3e007a8759508973f9c67209958e219e515bf8 (diff) | |
download | llvm-923f6ac018e3dd1c86bd4cee05e95680962e1446.zip llvm-923f6ac018e3dd1c86bd4cee05e95680962e1446.tar.gz llvm-923f6ac018e3dd1c86bd4cee05e95680962e1446.tar.bz2 |
[FastISel][AArch64] Compare Instruction Miscompilation Fix (#75993)
When shl is folded in compare instruction, a miscompilation occurs when
the CMP instruction is also sign-extended. For the following IR:
%op3 = shl i8 %op2, 3
%tmp3 = icmp eq i8 %tmp2, %op3
It used to generate
cmp w8, w9, sxtb #3
which means sign extend w9, shift left by 3, and then compare with the
value in w8. However, the original intention of the IR would require
`%op2` to first shift left before extending the operands in the
comparison operation . Moreover, if sign extension is used instead of
zero extension, the sample test would miscompile. This PR creates a fix
for the issue, more specifically to not fold the left shift into the CMP
instruction, and to create a zero-extended value rather than a
sign-extended value.
Diffstat (limited to 'llvm/lib/Object/WasmObjectFile.cpp')
0 files changed, 0 insertions, 0 deletions