Arnaud Allard de Grandmaison
2010-Feb-12 11:57 UTC
[LLVMdev] ConstantMerge & addressSpaces
Hello, 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. Best regards, -- Arnaud de Grandmaison -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100212/9fe3e7be/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: ConstantMerge.patch Type: application/octet-stream Size: 820 bytes Desc: ConstantMerge.patch URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100212/9fe3e7be/attachment.obj>
On Feb 12, 2010, at 3:57 AM, Arnaud Allard de Grandmaison wrote:> Hello, > > 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. >Nice catch, I took the opportunity to clean up the constmerge pass while fixing this: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20100208/096071.html -Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100212/d34b8489/attachment.html>