[PATCH] Fix GlobalOpt to use range metadata instead of creating SelectInsts.

Dan Gohman dan433584 at gmail.com
Fri Feb 28 11:38:51 PST 2014


Hello,

Previously, when GlobalOpt noticed that a GlobalVariable only ever has two
values, it replaced the GlobalVariable with a boolean, and introduced
SelectInsts to produce the desired values. The main purpose of this was to
expose the value range information to subsequent optimization passes.

espindola on IRC suggested that range metadata could achieve the same
purpose. Attached is a patch which replaces GlobalOpt's
TryToShrinkGlobalToBoolean with a TryToAddRangeMetadata. The metadata is
sufficient to enable the main optimization that TryToShrinkGlobalToBoolean
enabled, as can be seen in the test/Transforms/GlobalOpt/integer-bool.ll
test.

Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140228/0cec822b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: use-range-metadata-instead-of-introducing-selects.patch
Type: text/x-patch
Size: 8952 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140228/0cec822b/attachment.bin>


More information about the llvm-commits mailing list