Closed as not planned
Description
I can take this LLVM IR file, and compile it into an object file in two possible ways:
- Straight via
llc -filetype=obj
- Going via an assembly file with
llc -filetype=asm
, and then assembling that withllvm-mc
I would expect the two paths to yield the same object file; however, I get two object files that are different in very wild ways. In particular, there are lots of branches that are assembled differently:
colordiff -u worduino-avr.ll.o.dump worduino-avr.ll.s.o.dump
--- worduino-avr.ll.o.dump 2023-01-12 19:57:31.962629460 +0800
+++ worduino-avr.ll.s.o.dump 2023-01-12 19:57:32.022629930 +0800
@@ -83,7 +83,7 @@
96: 45 91 lpm r20, Z+
98: 4d 93 st X+, r20
9a: 31 50 subi r19, 0x01 ; 1
- 9c: e1 f7 brne .-8 ; 0x96 <_ZN15worduino_engine4draw11draw_sprite17hc7657142962e61a4E+0x96>
+ 9c: 01 f4 brne .+0 ; 0x9e <_ZN15worduino_engine4draw11draw_sprite17hc7657142962e61a4E+0x9e>
9e: 38 2f mov r19, r24
a0: 32 0f add r19, r18
a2: a3 2f mov r26, r19
Surely at least one of these two outputs must be wrong; I suspect brne .+0
(i.e. the output of llvm-mc
) can't be right, but that doesn't necessarily mean the other is correct either.
To reproduce, check out https://github.com/gergoerdi/llvm-issue-59962/tree/c942e79b663dcab1dee9d9a8c2d0079d321cd19d and run make
.