Issue 202695
Summary Possible Missed Optimization in O3
Labels new issue
Assignees
Reporter Apochens
    Reproducer: https://godbolt.org/z/7aq8fcz3v
Description: LLVM cannot optimize the following C function annotated with value range information, while GCC can.

```c
#include <stdint.h>

uint8_t src(uint8_t v1_u8, uint8_t v2_u8) {
  if (!(((uint8_t)14 <= v1_u8) && (v1_u8 <= (uint8_t)15))) __builtin_unreachable();
  if (!(((uint8_t)34 <= v2_u8) && (v2_u8 <= (uint8_t)35))) __builtin_unreachable();
  uint8_t i0_u8 = (uint8_t)(v2_u8 % v1_u8);
  uint8_t i1_u8 = (uint8_t)((uint8_t)i0_u8 >> (uint8_t)(uint8_t)2);
  return i1_u8;
}
```

LLVM's assembly result:
```assembly
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to