[PATCH] D132657: [DSE] Eliminate noop store even through has clobbering between LoadI and StoreI
    Eli Friedman via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Fri Sep  2 14:24:52 PDT 2022
    
    
  
efriedma added a comment.
gcc is doing something with alignment.  In the following, foo() is optimized, foo2() is not.
  struct A { int x; };
  struct __attribute((packed)) A2 { int x; };
  void foo(char *a) {
      struct A c = *((struct A *)a);
      *((struct A *)(a + 1)) = c;
      *((struct A *)a) = c;
  }
  void foo2(char *a) {
      struct A2 c = *((struct A2 *)a);
      *((struct A2 *)(a + 1)) = c;
      *((struct A2 *)a) = c;
  }
I'm not sure if gcc honors the alignment attribute in `(int __attribute__((aligned (1))) *)a`.
Repository:
  rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132657/new/
https://reviews.llvm.org/D132657
    
    
More information about the llvm-commits
mailing list