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

LLVM pretty produces an invalid .ll from rust-originated bitcode #15

Open
TomMD opened this issue May 31, 2017 · 0 comments
Open

LLVM pretty produces an invalid .ll from rust-originated bitcode #15

TomMD opened this issue May 31, 2017 · 0 comments

Comments

@TomMD
Copy link
Collaborator

TomMD commented May 31, 2017

Given the likely non-minimal rust:

pub fn f(x : i64) -> i32 {
    if x == 0 {
        return 1;
    } else {
        return 0;
   }
}

Observe:

$ rustc --emit llvm-bc --crate-type lib simple.rs -o simple.bc
$ llvm-disasm simple.bc > simple.ll
$ llc-3.8 simple.ll
llc-3.8: simple.ll:5:50: error: expected ')' at end of argument list
define i32 @_ZN6simple1f17hb796044fc140b16aE(i64 %0) {

The llvm-dis tool differs from llvm-disasm here:

llvm pretty (llvm-disasm):

define i32 @_ZN6simple1f17hb796044fc140b16aE(i64 %0) {
entry-block:
  %_0 = alloca i32, align 0
...

LLVM (llvm-dis):

define i32 @_ZN6simple1f17hb796044fc140b16aE(i64) unnamed_addr #0 {
entry-block:
  %_0 = alloca i32

So three things:

  • %0 name or not.
  • unnamed_addr #0 (or not)
  • align 0 (or not)

If I remove the %0 name and the align 0 then the llvm-disasm output does compile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant