Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AVR] At least one of llc and llvm-mc's output is wrong #59962

Closed
gergoerdi opened this issue Jan 12, 2023 · 2 comments
Closed

[AVR] At least one of llc and llvm-mc's output is wrong #59962

gergoerdi opened this issue Jan 12, 2023 · 2 comments
Labels
backend:AVR duplicate Resolved as duplicate

Comments

@gergoerdi
Copy link

gergoerdi commented Jan 12, 2023

I can take this LLVM IR file, and compile it into an object file in two possible ways:

  1. Straight via llc -filetype=obj
  2. Going via an assembly file with llc -filetype=asm, and then assembling that with llvm-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.

gergoerdi added a commit to gergoerdi/llvm-issue-59962 that referenced this issue Jan 12, 2023
@benshi001
Copy link
Member

This is a bug duplicates to #47093

@EugeneZelenko EugeneZelenko added the duplicate Resolved as duplicate label Jan 13, 2023
@EugeneZelenko EugeneZelenko closed this as not planned Won't fix, can't repro, duplicate, stale Jan 13, 2023
@gergoerdi
Copy link
Author

As of 5fcdf76 (i.e. with 6dc85bd included) I am still seeing the same problem in llvm-mc's output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:AVR duplicate Resolved as duplicate
Projects
None yet
Development

No branches or pull requests

3 participants