[llvm] r232046 - [X86] Fix wrong target specific combine on SETCC nodes.

Andrea Di Biagio andrea.dibiagio at gmail.com
Thu Mar 12 09:53:47 PDT 2015


Sorry... I posted the wrong example.
This is the original test case looked like this:

/* test.c */
typedef int int4 __attribute__((vector_size(16)));

__attribute__((noinline))
int foo(int4 A, int4 B) {
  int4 Zero = (int4){0,0,0,0};
  int4 C = A < B;
  int4 D = C > Zero;
  return D[1];
}

int main() {
  int4 A = (int4){1,1,1,1};
  int4 B = (int4){2,2,2,2};
  printf("%d\n", foo(A, B));
  return 0;
}
/* end of test.c */

$ clang test.c
$ ./a.out
0

$ clang test.c -O2
$ ./a.out
-1

On Thu, Mar 12, 2015 at 4:48 PM, Andrea Di Biagio
<andrea.dibiagio at gmail.com> wrote:
> Yes. It affects 3.6 as well.
> That said, I expect this bug to only occur in very rare cases.
> It was only spotted by one of our randomly generated tests.
>
> P.s.:  The original reproducible looked like this:
> ///
> typedef int int4 __attribute__((vector_size(16)));
>
> __attribute__((noinline))
> int foo(int4 A, int4 B) {
>   int4 Zero = (int4){0,0,0,0};
>   int4 C = A < B;
>   int4 D = C > Zero;
>   return D[1];
> }
>
> int main() {
>   int4 A = (int4){1,1,1,1};
>   int4 B = (int4){1,1,1,1};
>   printf("%d\n", foo(A, B);
>   return 0;
> }
> ////
>
> At -O0 it was printing out the value 0.
> At -O2 it was printing out the value -1.
>
>
>
> On Thu, Mar 12, 2015 at 4:24 PM, Joerg Sonnenberger
> <joerg at britannica.bec.de> wrote:
>> On Thu, Mar 12, 2015 at 03:16:58PM -0000, Andrea Di Biagio wrote:
>>> Author: adibiagio
>>> Date: Thu Mar 12 10:16:58 2015
>>> New Revision: 232046
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=232046&view=rev
>>> Log:
>>> [X86] Fix wrong target specific combine on SETCC nodes.
>>
>> Does this apply to 3.6, too?
>>
>> Joerg
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list