glider added a comment.

Well, now we somewhat break padding initialization.

E.g. for the following struct:

  struct s { 
    int a;
    char b;
    long int c;
  };

we generate the following constant initializer with `-O0`:

  .L__const.foo.local:
          .long   2863311530              # 0xaaaaaaaa
          .byte   170                     # 0xaa
          .zero   3   
          .quad   -6148914691236517206    # 0xaaaaaaaaaaaaaaaa
          .size   .L__const.foo.local, 16

, which overwrites the padding bytes on stack, but with a wrong constant.

OTOH with `-O1` (i.e. with my patch) we generate the following sequence of 
stores:

  movl    $-1431655766, 8(%rsp)   # imm = 0xAAAAAAAA
  movb    $-86, 12(%rsp)
  movabsq $-6148914691236517206, %rax # imm = 0xAAAAAAAAAAAAAAAA
  movq    %rax, 16(%rsp)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57898/new/

https://reviews.llvm.org/D57898



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to