[llvm-commits] [llvm] r167691 - /llvm/trunk/test/Transforms/InstCombine/memcmp-1.ll

Chris Lattner clattner at apple.com
Sun Nov 11 15:39:57 PST 2012


On Nov 11, 2012, at 2:07 PM, Eli Friedman <eli.friedman at gmail.com> wrote:
>>  %mem1 = getelementptr [4 x i8]* @hel, i32 0, i32 0
>>  %mem2 = getelementptr [4 x i8]* @foo, i32 0, i32 0
>>  %ret = call i32 @memcmp(i8* %mem1, i8* %mem2, i32 3)
>>  ret i32 %ret
>>  ; CHECK: ret i32 2
>> 
>> The folded return value (2 above) is computed using the system memcmp
>> that the compiler is linked with.  This can return different values on
>> different systems.  The test was originally written on an OS X 10.7.5
>> x86-64 box and passed.  However, it failed on one of the x86-64 FreeBSD
>> buildbots because the system memcpy on that machine returned a different
>> value (1 instead of 2).
>> 
>> I fixed the test by checking the folding constants with regexes.
> 
> This seems wrong: we prefer that transforms are consistent across
> platforms where possible.  Please fix the transform so it doesn't vary
> based on the return value of the system memcmp.

Right - this matters a lot for cross compiles.

-Chris



More information about the llvm-commits mailing list