[LLVMdev] Cannot interchange "literal" and "identified" structs

Justin Holewinski justin.holewinski at gmail.com
Sun Dec 30 05:39:14 PST 2012


With primitive types, I can interchange literal usage and type aliases in
IR:

%mytype = type i32

define void @foo(%mytype* %ptr) {
  %t1 = load *%mytype** %ptr
  store i32 *%t1*, *i32** %ptr
  ret void
}

But for structs, I cannot:

%mytype = type { i32, i32 }

define void @foo(%mytype* %ptr) {
  %t1 = load *%mytype** %ptr
  store* { i32, i32 }* %t1, *{ i32, i32 }** %ptr
  ret void
}

bin/llvm-as: alias2.ll:6:22: error: '%t1' defined with type '%mytype = type
{ i32, i32 }'
  store { i32, i32 } %t1, { i32, i32 }* %ptr

I don't see anything in the language reference manual that disallows such
usage, as the literal struct type and %mytype are equivalent.  Am I missing
something here, or is this just a bug in the assembly parser?

-- 

Thanks,

Justin Holewinski
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121230/f5b42f91/attachment.html>


More information about the llvm-dev mailing list