-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Open
Labels
llvm:instcombineCovers the InstCombine, InstSimplify and AggressiveInstCombine passesCovers the InstCombine, InstSimplify and AggressiveInstCombine passesregression
Description
https://godbolt.org/z/65Tza7cdf
#include <stdint.h>
extern uint16_t qwe, asd, zxc, zzz;
int firewall(const uint8_t *restrict data) {
const uint8_t ip_proto = *data;
const uint16_t dst_port = *((const uint16_t *)data + 32);
if (ip_proto == 17 && dst_port == qwe) return 1;
if (ip_proto == 17 && dst_port == asd) return 1;
if (ip_proto == 17 && dst_port == zxc) return 1;
if (ip_proto == 17 && dst_port == zzz) return 1;
return 0;
}
firewall: # @firewall
mov dl, byte ptr [rdi]
movzx ecx, word ptr [rdi + 64]
mov eax, 1
cmp dl, 17
jne .LBB0_2
cmp cx, word ptr [rip + qwe]
jne .LBB0_2
.LBB0_7:
ret
.LBB0_2:
cmp dl, 17
jne .LBB0_4
cmp cx, word ptr [rip + asd]
je .LBB0_7
.LBB0_4:
cmp dl, 17
jne .LBB0_6
cmp cx, word ptr [rip + zxc]
je .LBB0_7
.LBB0_6:
cmp dl, 17
sete al
cmp cx, word ptr [rip + zzz]
sete cl
and cl, al
movzx eax, cl
ret
Compiled with -O3 to x86_64.
cmp dl, 17
is repeated for some reason. This is a bug as I think.
jordanrule and cpplearner
Metadata
Metadata
Assignees
Labels
llvm:instcombineCovers the InstCombine, InstSimplify and AggressiveInstCombine passesCovers the InstCombine, InstSimplify and AggressiveInstCombine passesregression