glider added a comment. Not sure if a similar problem was mentioned already or not, but the following program:
void alloc_sock(int *err); int try_send(); int send(int len) { int err; if (len) { err = -1; alloc_sock(&err); err = try_send(); } return -1; } produces a redundant store of `0xaaaaaaaa` to `err`: 0000000000000000 <send>: void alloc_sock(int *err); int try_send(); int send(int len) { 0: 50 push %rax int err; 1: c7 44 24 04 aa aa aa movl $0xaaaaaaaa,0x4(%rsp) 8: aa if (len) { 9: 85 ff test %edi,%edi b: 74 1d je 2a <send+0x2a> err = -1; d: c7 44 24 04 ff ff ff movl $0xffffffff,0x4(%rsp) 14: ff 15: 48 8d 7c 24 04 lea 0x4(%rsp),%rdi alloc_sock(&err); 1a: e8 00 00 00 00 callq 1f <send+0x1f> 1b: R_X86_64_PLT32 alloc_sock-0x4 err = try_send(); 1f: 31 c0 xor %eax,%eax 21: e8 00 00 00 00 callq 26 <send+0x26> 22: R_X86_64_PLT32 try_send-0x4 26: 89 44 24 04 mov %eax,0x4(%rsp) } return -1; 2a: b8 ff ff ff ff mov $0xffffffff,%eax 2f: 59 pop %rcx 30: c3 retq Not sure whether this isn't a bug in DSE though. Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D54604/new/ https://reviews.llvm.org/D54604 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits