[llvm] r220324 - Preserve 'nonnull' when changing type of the load.

Charles Davis cdavis5x at gmail.com
Wed Feb 11 19:12:23 PST 2015


> On Oct 21, 2014, at 3:00 PM, Philip Reames <listmail at philipreames.com> wrote:
> 
> Author: reames
> Date: Tue Oct 21 16:00:03 2014
> New Revision: 220324
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=220324&view=rev
> Log:
> Preserve 'nonnull' when changing type of the load.
> 
> When changing the type of a load in Chandler's recent InstCombine changes, we can preserve the new 'nonnull' metadata.  
> 
> I considered adding an assert since 'nonnull' is only valid on pointer types, but casting a pointer to a non-pointer would involve more than a bitcast anyways.  If someone extends this transform to handle more than bitcasts, the verifier will report the malformed IR, so a separate assertion isn't needed.
Hi Philip and Chandler,

Some recent changes to LLVM may have exposed a problem with this.

Under certain conditions, if InstCombine attempts to canonicalize loads like this, we get a load of an integer with !nonnull metadata. I’ve attached a patch that contains a test that demonstrates this, and a fix that makes the test pass.

Shall I commit this right away? And should we also fix stores with !nonnull metadata?

Chip
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-InstCombine-Don-t-propagate-nonnull-metadata-to-inte.patch
Type: application/octet-stream
Size: 2650 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150211/6cb486a5/attachment.obj>


More information about the llvm-commits mailing list