[PATCH v6 9/9] drm/amd/display: Mark dc_fixpt_from_fraction() noinline
Xi Ruoyao
xry111 at xry111.site
Sat Dec 21 07:40:12 UTC 2024
On Fri, 2024-12-20 at 15:34 -0700, Nathan Chancellor wrote:
> > Now, the thing is, these ASSERT()s are checking for divide-by-zero, I
> > suspect clang figured that out and invokes UB on us and just stops
> > code-gen.
>
> Yeah, I think your analysis is spot on, as this was introduced by a
> change in clang from a few months ago according to my bisect:
>
> https://github.com/llvm/llvm-project/commit/37932643abab699e8bb1def08b7eb4eae7ff1448
>
> Since the ASSERT does not do anything to prevent the divide by zero (it
> just flags it with WARN_ON) and the rest of the code doesn't either, I
> assume that the codegen stops as soon as it encounters the unreachable
> that change created from the path where divide by zero would occur via
>
> dc_fixpt_recip() ->
> dc_fixpt_from_fraction() ->
> complete_integer_division_u64() ->
> div64_u64_rem()
>
> Shouldn't callers of division functions harden them against dividing by
> zero?
Yes I think it'd be the correct solution.
--
Xi Ruoyao <xry111 at xry111.site>
School of Aerospace Science and Technology, Xidian University
More information about the amd-gfx
mailing list