[PATCH] D15544: [SelectionDAGBuilder] Set NoUnsignedWrap on ISD::ADD for inbounds gep
Dan Gohman via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 15 15:23:08 PST 2015
sunfish created this revision.
sunfish added subscribers: majnemer, llvm-commits.
sunfish set the repository for this revision to rL LLVM.
Herald added subscribers: dschuff, jfb.
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 specifically useful to the WebAssembly backend, since it permits stronger constant offset folding.
Repository:
rL LLVM
http://reviews.llvm.org/D15544
Files:
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
test/CodeGen/WebAssembly/offset.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15544.42917.patch
Type: text/x-patch
Size: 8456 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151215/70f97bf4/attachment.bin>
More information about the llvm-commits
mailing list