PATCH: do ?: lowering to selects less wrong

Nick Lewycky nlewycky at google.com
Tue Nov 5 17:44:01 PST 2013


On 5 November 2013 17:30, Rafael EspĂ­ndola <rafael.espindola at gmail.com>wrote:

> The test passes even with the code change reverted.
>

Bah! Thanks for noticing. The testcase worked in C++ mode but not C mode.

Adding it to test/CodeGenCXX/catch-undef-behavior.cpp doesn't work well
either because of ordering dependencies in that test.

Updated patch attached!

Nick

On 5 November 2013 16:54, Nick Lewycky <nlewycky at google.com> wrote:
> > When lowering "cond ? X : Y" we do some safety checks to see whether we
> can
> > instead emit both X and Y and use a llvm select instruction to choose
> > between them. This code is insufficiently safe, and introducing loads
> into a
> > program that didn't load is a bad idea. For example, it could be TLS. It
> > could be a non-volatile auto in another function that isn't the current
> > function (think lambdas).
> >
> > Don't do this here. LLVM knows how to do this properly.
> >
> > Patch attached, please review!
> >
> > Nick
> >
> >
> > _______________________________________________
> > cfe-commits mailing list
> > cfe-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131105/4c1b8390/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: loads-arent-cheap-2.patch
Type: text/x-patch
Size: 2281 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131105/4c1b8390/attachment.bin>


More information about the cfe-commits mailing list