<div dir="ltr"><div>Hello,<br><br></div><div>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.<br>
<br>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.<br>
<br>Dan<br></div><br></div>