[prev in list] [next in list] [prev in thread] [next in thread] 

List:       llvm-dev
Subject:    Re: [llvm-dev] Clang IR Compile Bug?
From:       platin21 via llvm-dev <llvm-dev () lists ! llvm ! org>
Date:       2021-12-27 21:46:53
Message-ID: ACA15FA4-F3F4-47B8-94A5-ACAF64E59B2F () icloud ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Ok this seems to be a weird ness that llvm does if the ABI is not happy with doing \
what one does. As in if you return something bigger than 4 bytes with default return \
on aarch64 it seems like it's not happy an creates trash code because it would expect \
this code to make a sret instead. Which is understandable still a bit annoying that \
it doesn't give any hint that this is wrong.

So all in all it's just not ABI compliant todo what I did and as such ok to create \
crap code. 

Best regards,
Platin21

> Am 27.12.2021 um 20:15 schrieb platin21 via llvm-dev <llvm-dev@lists.llvm.org>:
> 
> Hello Everyone,
> 
> May I ask is there anything different in clang when compiling ir than to when \
> compiling with llc. In particular it seems to cause some problems with returning \
> floats directly but only if they are over 8 bytes in size.  
> I added the ir as attachment when compiled on arm-macOS via:
> > clang trs.ll 
> It causes this code to not work correctly.
> 
> If compiled with llc and then linked with clang it works:
> > llc  -filetype=obj trs.ll -o trs.o
> > clang trs.o -o trs
> 
> I yet have to find out why this happens when using clang directly. If anyone has a \
> guess would be nice to know. The same problem also happens in the backend which I'm \
> currently helping with to develop here i though don't know how to fix that as I \
> can't simply call llc as it's using the llvm-c api todo all of this.  
> Link to IL Code => https://1drv.ms/u/s!Atg5BVAOHU2EgaBr2UaRfTgjUsUgHw?e=TmGbo5 \
> <https://1drv.ms/u/s!Atg5BVAOHU2EgaBr2UaRfTgjUsUgHw?e=TmGbo5> 
> Best regards,
> Platin21
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


[Attachment #5 (unknown)]

<html><head><meta http-equiv="Content-Type" content="text/html; \
charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; \
line-break: after-white-space;" class="">Ok this seems to be a weird ness that llvm \
does if the ABI is not happy with doing what one does.<div class="">As in if you \
return something bigger than 4 bytes with default return on aarch64 it seems like \
it's not happy an creates trash code because it would expect this code to make a sret \
instead. Which is understandable still a bit annoying that it doesn't give any hint \
that this is wrong.</div><div class=""><br class=""></div><div class="">So all in all \
it's just not ABI compliant todo what I did and as such ok to create crap \
code.&nbsp;</div><div class=""><br class=""></div><div class="">Best \
regards,</div><div class="">Platin21<br class=""><div><br class=""><blockquote \
type="cite" class=""><div class="">Am 27.12.2021 um 20:15 schrieb platin21 via \
llvm-dev &lt;<a href="mailto:llvm-dev@lists.llvm.org" \
class="">llvm-dev@lists.llvm.org</a>&gt;:</div><br \
class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" \
content="text/html; charset=utf-8" class=""><div style="word-wrap: break-word; \
-webkit-nbsp-mode: space; line-break: after-white-space;" class=""><span \
style="caret-color: rgb(0, 0, 0);" class="">Hello Everyone,</span><br \
style="caret-color: rgb(0, 0, 0);" class=""><br style="caret-color: rgb(0, 0, 0);" \
class=""><span style="caret-color: rgb(0, 0, 0);" class="">May I ask is there \
anything different in clang when compiling ir than to when compiling with \
llc.</span><br style="caret-color: rgb(0, 0, 0);" class=""><span style="caret-color: \
rgb(0, 0, 0);" class="">In particular it seems to cause some problems with returning \
floats directly but only if they are over 8 bytes in size.&nbsp;</span><br \
style="caret-color: rgb(0, 0, 0);" class=""><br style="caret-color: rgb(0, 0, 0);" \
class=""><span style="caret-color: rgb(0, 0, 0);" class="">I added the ir as \
attachment when compiled on arm-macOS via:</span><br style="caret-color: rgb(0, 0, \
0);" class=""><blockquote type="cite" class="">clang trs.ll&nbsp;<br \
class=""></blockquote><span style="caret-color: rgb(0, 0, 0);" class="">It causes \
this code to not work correctly.</span><br style="caret-color: rgb(0, 0, 0);" \
class=""><br style="caret-color: rgb(0, 0, 0);" class=""><span style="caret-color: \
rgb(0, 0, 0);" class="">If compiled with llc and then linked with clang it \
works:</span><br style="caret-color: rgb(0, 0, 0);" class=""><blockquote type="cite" \
class="">llc &nbsp;-filetype=obj trs.ll -o trs.o<br class="">clang trs.o -o trs<br \
class=""></blockquote><br style="caret-color: rgb(0, 0, 0);" class=""><span \
style="caret-color: rgb(0, 0, 0);" class="">I yet have to find out why this happens \
when using clang directly. If anyone has a guess would be nice to know.</span><div \
class=""><font class="">The same problem also happens in the backend which&nbsp;I'm \
currently helping with to develop here i though don't know how to fix that as&nbsp;I \
can't simply call llc as it's using the llvm-c api todo all of \
this.&nbsp;</font></div><div class=""><font class=""><br class=""></font></div><div \
class=""><font class="">Link to IL Code =&gt;&nbsp;<span style="caret-color: rgb(0, \
0, 0);" class=""><a href="https://1drv.ms/u/s!Atg5BVAOHU2EgaBr2UaRfTgjUsUgHw?e=TmGbo5" \
class="">https://1drv.ms/u/s!Atg5BVAOHU2EgaBr2UaRfTgjUsUgHw?e=TmGbo5</a></span></font></div><div \
class=""><font class=""><br class=""></font></div><div class=""><font class="">Best \
regards,</font></div><div class=""><font class=""><span style="caret-color: rgb(0, 0, \
0);" class="">Platin21</span></font></div></div>_______________________________________________<br \
class="">LLVM Developers mailing list<br class=""><a \
href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br \
class="">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev<br \
class=""></div></blockquote></div><br class=""></div></body></html>


[Attachment #6 (text/plain)]

_______________________________________________
LLVM Developers mailing list
llvm-dev@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic