It seems I stepped on a bug with the ConstantMerge IPO pass, regarding address spaces.
For example, if a module contains the following:
@a = internal constant i16 224
@b = internal addrspace(30) constant i16 224
Although a & b have the same initializer, i think they should not be merged. Attempting to do it anyway will trigger an assertion.
I guess the safe and easy way is to only merge constants in the 0 address space, as the other address spaces may need a target specific behaviour. The patch for this is attached.
ConstantMerge.patch (820 Bytes)