Sanjoy Das via llvm-dev
2016-May-30 23:04 UTC
[llvm-dev] Loads and stores of unsized types?
This came up in D20764, this IR verifies today: %X = type opaque define void @f_0(%X* %ptr) { %t = load %X, %X* %ptr ret void } define void @f_1(%X %val, %X* %ptr) { store %X %val, %X* %ptr ret void } which I found surprising -- what does it mean to load / store values of unknown sizes? Passing it to llc fails an assertion. Are there legitimate cases where we'd want to generate such IR? -- Sanjoy
David Majnemer via llvm-dev
2016-May-31 01:40 UTC
[llvm-dev] Loads and stores of unsized types?
On Mon, May 30, 2016 at 4:04 PM, Sanjoy Das via llvm-dev < llvm-dev at lists.llvm.org> wrote:> This came up in D20764, this IR verifies today: > > %X = type opaque > > define void @f_0(%X* %ptr) { > %t = load %X, %X* %ptr > ret void > } > > define void @f_1(%X %val, %X* %ptr) { > store %X %val, %X* %ptr > ret void > } > > which I found surprising -- what does it mean to load / store values > of unknown sizes? Passing it to llc fails an assertion. Are there > legitimate cases where we'd want to generate such IR? >You can also get it to crash by throwing it at InstCombine. I think we should add a verifier rule to make memory operations sized.> > -- Sanjoy > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160530/cc278c79/attachment.html>
Chandler Carruth via llvm-dev
2016-Jun-01 00:07 UTC
[llvm-dev] Loads and stores of unsized types?
To reiterate what I said on IRC, I agree with David and would expect the verifier to reject unsized loads and stores. On Mon, May 30, 2016 at 4:05 PM Sanjoy Das via llvm-dev < llvm-dev at lists.llvm.org> wrote:> This came up in D20764, this IR verifies today: > > %X = type opaque > > define void @f_0(%X* %ptr) { > %t = load %X, %X* %ptr > ret void > } > > define void @f_1(%X %val, %X* %ptr) { > store %X %val, %X* %ptr > ret void > } > > which I found surprising -- what does it mean to load / store values > of unknown sizes? Passing it to llc fails an assertion. Are there > legitimate cases where we'd want to generate such IR? > > -- Sanjoy > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160601/ef67988a/attachment.html>
Sanjoy Das via llvm-dev
2016-Jun-01 00:50 UTC
[llvm-dev] Loads and stores of unsized types?
Patch for review: http://reviews.llvm.org/D20846 On Tue, May 31, 2016 at 5:07 PM, Chandler Carruth <chandlerc at gmail.com> wrote:> To reiterate what I said on IRC, I agree with David and would expect the > verifier to reject unsized loads and stores. > > On Mon, May 30, 2016 at 4:05 PM Sanjoy Das via llvm-dev > <llvm-dev at lists.llvm.org> wrote: >> >> This came up in D20764, this IR verifies today: >> >> %X = type opaque >> >> define void @f_0(%X* %ptr) { >> %t = load %X, %X* %ptr >> ret void >> } >> >> define void @f_1(%X %val, %X* %ptr) { >> store %X %val, %X* %ptr >> ret void >> } >> >> which I found surprising -- what does it mean to load / store values >> of unknown sizes? Passing it to llc fails an assertion. Are there >> legitimate cases where we'd want to generate such IR? >> >> -- Sanjoy >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-- Sanjoy Das http://playingwithpointers.com