[SelectionDAGBuilder] Set NoUnsignedWrap for inbounds gep and load/store…

Description

[SelectionDAGBuilder] Set NoUnsignedWrap for inbounds gep and load/store offsets.

In an inbounds getelementptr, when an index produces a constant non-negative
offset to add to the base, the add can be assumed to not have unsigned overflow.

This relies on the assumption that addresses can't occupy more than half the
address space, which isn't possible in C because it wouldn't be possible to
represent the difference between the start of the object and one-past-the-end
in a ptrdiff_t.

Setting the NoUnsignedWrap flag is theoretically useful in general, and is
specifically useful to the WebAssembly backend, since it permits stronger
constant offset folding.

Differential Revision: http://reviews.llvm.org/D15544

Details

Committed
djgJan 5 2016, 4:43 PM
Differential Revision
D15544: [SelectionDAGBuilder] Set NoUnsignedWrap on ISD::ADD for inbounds gep
Parents
rL256889: use std::max ; NFCI
Branches
Unknown
Tags
Unknown