Issue 137739
Summary UB optimization leads to really bad code gen
Labels new issue
Assignees
Reporter bwendling
    Linux has some code that may result in dividing by zero or shifting by negative numbers. For instance, in one of the ARMGPU drivers, a "divide by zero" results in a fall through into the following function.

```
drivers/gpu/drm/amd/amdgpu/../display/dc/basics/fixpt31_32.o:
 warning: objtool: dc_fixpt_recip() falls through to next function dc_fixpt_sinc()

drivers/gpu/drm/amd/amdgpu/../display/dc/sspl/spl_fixpt31_32.o:
 warning: objtool: spl_fixpt_recip() falls through to next function spl_fixpt_sinc()
```

It is undefined behavior, but in these cases it will silently generate incorrect code. It's far better to generate the bad code so that it signals/traps/whatever.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to