<p dir="ltr">The right solution is to not use incomplete types here as all of my other commits indicated. Sorry I didn't catch the uses in Polly last night. They just need to be fixed like every other LLVM project. I'll finish this morning and re-land.</p>
<br><div class="gmail_quote"><div dir="ltr">On Wed, Dec 30, 2015, 06:45 Tobias Grosser via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 12/30/2015 05:00 AM, Chandler Carruth via llvm-commits wrote:<br>
> Author: chandlerc<br>
> Date: Tue Dec 29 22:00:24 2015<br>
> New Revision: 256620<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=256620&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=256620&view=rev</a><br>
> Log:<br>
> [ptr-traits] Implement the base pointer traits using the actual<br>
> alignment of the pointee type!<br>
><br>
> This is the culmination of the ptr-traits work. Now the compiler will<br>
> catch me if I try to use a pointer to an empty struct as a key in<br>
> a dense map or inside a PointerIntPair or PointerUnion! This is much,<br>
> much better than sometimes corrupting data (and other times working<br>
> fine) due to insufficient alignment.<br>
><br>
> It also means that we will be much more diligent about rejecting other<br>
> uses of these constructs that aren't safe.<br>
><br>
> It also means that we can now be more aggressive with the constructs<br>
> when we actually have guaranteed higher alignment without specializing<br>
> stuff. I'll be going through and cleaning up all the current overrides<br>
> of these traits which are no longer necessary.<br>
><br>
> Many thanks to Richard, David, and others who helped me get all of this<br>
> together.<br>
<br>
This broke the use of incomplete types (and as a result Polly). I<br>
temporarily reverted this commit in 256642.<br>
<br>
I spent some more time to look into what the right solution for<br>
incomplete pointer types might be and came up with three possible solutions:<br>
<br>
1) Generally avoid incomplete pointer types<br>
<br>
2) Add PointerLikeTypeTraits for any incomplete type used<br>
<br>
3) Teach PointerLikeTypeTraits to be conservative in case of incomplete<br>
    types.<br>
<br>
<br>
1) does not seem to be a solution as in incomplete pointer types are in<br>
our case used to hide implementation details. I do not think exposing<br>
the actual type is the right approach.<br>
<br>
Solution 2) can be easily implemented (I realized this after reverting).<br>
I attached a patch that adds two PointerLikeTypeTraits with<br>
"enum { NumLowBitsAvailable = 0 };" for the two incomplete types in<br>
Polly. This is sufficient to pass 'make check'. There are likely more<br>
bits available, but at least the isl interface does not give any<br>
guarantees. I assume these patches would be sufficient to get Chandlers<br>
change while ensuring that Polly still builds. If you think this is<br>
indeed the right approach, I would be happy to add this to Polly and go<br>
on with life.<br>
<br>
Regarding 3), I wonder if we could make the behavior of 2) the default<br>
for all incomplete types. Maybe there is some C++-magic available that<br>
would allow us to do this easily?<br>
<br>
Best,<br>
Tobias<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>