This repository was archived by the owner on Jul 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 182
This repository was archived by the owner on Jul 1, 2023. It is now read-only.
BOLT/LLVM? does not preserve prefixes on conditional branches #294
Copy link
Copy link
Open
Description
Discussing with @maksfb it looks like it is similar to issue https://reviews.llvm.org/D120592
I have an input binary of the form
0000000000401169 <main>:
401169: 89 f8 mov %edi,%eax
40116b: 83 ff 01 cmp $0x1,%edi
40116e: 2e 74 06 je,pn 401177 <main+0xe>
401171: 83 ff 02 cmp $0x2,%edi
401174: 2e 75 01 jne,pn 401178 <main+0xf>
401177: c3 retq
401178: 83 ff 03 cmp $0x3,%edi
40117b: 2e 74 f9 je,pn 401177 <main+0xe>
40117e: b8 04 00 00 00 mov $0x4,%eax
401183: eb f2 jmp 401177 <main+0xe>
401185: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1)
40118c: 00 00 00
It has 3 conditional branches with a prefix of 2e. This is the output after BOLTing. The 3 conditional branches don't have the prefixes anymore.
0000000000401169 <main>:
401169: 89 f8 mov %edi,%eax
40116b: 83 ff 01 cmp $0x1,%edi
40116e: 74 05 je 401175 <main+0xc>
401170: 83 ff 02 cmp $0x2,%edi
401173: 75 01 jne 401176 <main+0xd>
401175: c3 retq
401176: 83 ff 03 cmp $0x3,%edi
401179: 74 fa je 401175 <main+0xc>
40117b: b8 04 00 00 00 mov $0x4,%eax
401180: eb f3 jmp 401175 <main+0xc>
401182: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1)
401189: 00 00 00
40118c: 0f 1f 40 00 nopl 0x0(%rax)
This looks like an underlying LLVM problem and not a BOLT problem? I noticed the llvm-objdump does not seem to know about the prefixes, compared to the regular objdump. @maksfb @rafaelauler @aaupov
0000000000401169 <main>:
401169: 89 f8 movl %edi, %eax
40116b: 83 ff 01 cmpl $1, %edi
40116e: 2e 74 06 je 0x401177 <main+0xe>
401171: 83 ff 02 cmpl $2, %edi
401174: 2e 75 01 jne 0x401178 <main+0xf>
401177: c3 retq
401178: 83 ff 03 cmpl $3, %edi
40117b: 2e 74 f9 je 0x401177 <main+0xe>
40117e: b8 04 00 00 00 movl $4, %eax
401183: eb f2 jmp 0x401177 <main+0xe>
401185: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:(%rax,%rax)
40118f: 90 nop
Thanks
--Suresh
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels