[PATCH] D51794: AMDGPU: Don't error on calls to null or undef

Stanislav Mekhanoshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 10 10:44:28 PDT 2018


rampitec added a comment.

In https://reviews.llvm.org/D51794#1228453, @arsenm wrote:

> In https://reviews.llvm.org/D51794#1228246, @rampitec wrote:
>
> > In https://reviews.llvm.org/D51794#1228202, @arsenm wrote:
> >
> > > HCC had a bug recently that was producing calls to under. I assume a call to null would appear for a pure virtual call. They are undefined to execute, but they could appear in dead code that is never reached so it’s not an error to have them exist
> >
> >
> > A standard reaction to pure virtual call is a runtime error message and abort. We cannot produce an error message from kernel but we can abort. I would suggest to lower it to s_trap.
>
>
> I don't think this is how that's implemented. Other targets generate a literal call to null in this case. This is an edge case since typically undef/null calls are turned into unreachable in simplifycfg, which there is a flag to generate a trap on separately.


That is actually very inconvenient to debug kernels which simply hang or misbehave, even if that is an UB. I still suggest our action of preference on unreachable code is to trap. Whenever we can or cannot do it consistently for all unreachable does not seem to matter, we need to start somewhere.


https://reviews.llvm.org/D51794





More information about the llvm-commits mailing list