This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU: Fix crashing on calls to C functions from graphics contexts
ClosedPublic

Authored by arsenm on Jan 17 2022, 6:41 AM.

Details

Reviewers
rampitec
foad
sebastian-ne
Group Reviewers
Restricted Project
Summary

If we had one of the shader calling conventions calling a default
calling convention callee, this would crash when the caller did not
have anything to pass to the workitem ID.

This is illegal, but we still need to produce something
sensible. llvm-reduce likes to replace calls to intrinsics with calls
to null or undef, so this does appear and is helpful to avoid hard
erroring.

Pass undef in this case, as already happened for the other implicit
arguments. It might make sense to define the behavior here and pass
null for the pointers, and -1 for the workitem ID. We do have extra
bits in the workitem ID, so this wouldn't conflict with a valid value.

Diff Detail