[clang] [llvm] [InstCombine] Infer zext nneg flag (PR #71534)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 9 01:47:18 PST 2023
dyung wrote:
We also have a couple of internal tests that seem to be failing after this commit. Consider the following code:
```c++
char print_tmp[1];
void print(char *, void *data, unsigned size) {
unsigned char *bytes = (unsigned char *)data;
for (unsigned i = 0; i != size; ++i)
sprintf(print_tmp + i * 2, "%02x", bytes[size - 1 - i]);
printf(print_tmp);
}
#define PRINT(VAR) print(#VAR, &VAR, sizeof(VAR))
struct {
long b : 17;
} test141_struct_id29534;
struct test141_struct_id29574_ {
test141_struct_id29574_() { INIT(172, *this); }
unsigned a : 15;
} test141_struct_id29574;
int main() {
long id29692 = test141_struct_id29534.b = test141_struct_id29574.a;
PRINT(id29692);
}
```
When compiled without optimizations (and before this change with optimization) it would print out the value `0000000000002dac`. But after this change, when optimizations are enabled, the program now prints out `000000000000adac`.
You can see the difference at https://godbolt.org/z/vjPvGT5G9.
https://github.com/llvm/llvm-project/pull/71534
More information about the llvm-commits
mailing list