It should be possible to pull all cc-param calls out of the else section of the CFLAGS_KASAN_SHADOW check. Then, the code structure would make sense: first, try applying KASAN_SHADOW_OFFSET; if failed, use CFLAGS_KASAN_MINIMAL; and then try applying all these options one by one.
https://lkml.kernel.org/r/YV0NPnUbElw7cTRH@archlinux-ax161