<div dir="ltr"><div><div>Not to put words in Joerg's mouth, but he kind of alluded to a possible way forward.<br></div>You might want to define a target hook (say in Target Lowering) for say `allowsUnalignedAtomicMemOps()` that would return `false` on all targets but yours. Of course, you should definitely investigate whether there is a reason for this diagnostic (i.e. whether some other passes require natural alignment).<br><br></div>Another thing I find useful is using `svn blame` on the file in question to see what revision the diagnostic was added in. Chances are the commit message or the associated review will have some info on why it was needed.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Aug 26, 2017 at 4:50 PM, Dr. ÉRDI Gergő via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div>So does that mean that this assertion is simply being over-defensive in anticipation of target-specific code further downstream failing on non-aligned atomic operations? It seems like a much better place for an assertion like this would be near the target-specific code (if any) that needs this precondition.</div><div dir="auto"><br></div><div dir="auto">Can you recommend a way forward? Should I add some new method that tells the non-target-specific code the alignment requirements of the current target?<div><div class="h5"><br><div class="gmail_extra" dir="auto"><br><div class="gmail_quote">On Aug 26, 2017 20:54, "Joerg Sonnenberger via llvm-dev" <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br type="attribution"><blockquote class="m_-8290251041368633222quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="m_-8290251041368633222quoted-text">On Sat, Aug 26, 2017 at 08:31:30PM +0800, Dr. ERDI Gergo via llvm-dev wrote:<br>
> This trips up the following assertion in CodeGen/SelectionDAG/Selection<wbr>DAGBuilder.cpp:<br>
><br>
>   if (I.getAlignment() < VT.getSizeInBits() / 8)<br>
>     report_fatal_error("Cannot generate unaligned atomic load");<br>
><br>
><br>
> I've tried commenting out the check and llc finishes, generating<br>
> not-obviously-wrong machine code, so there doesn't seem to be anything<br>
> further downstream breaking because of this.<br>
><br>
> So my questions are:<br>
><br>
> * What is the purpose of this assertion?<br>
<br>
</div>Existing targets so far simply don't support unaliged atomic ops. That's<br>
why it hasn't been refactored into a target information hook.<br>
<br>
Joerg<br>
______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
</blockquote></div><br></div></div></div></div></div>
<br>______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br></div>