[AMDGPU] Fix function pointer argument bug in AMDGPU Propagate Attributes pass.
authorjweightma <jacob.weightman@hpe.com>
Wed, 26 May 2021 14:33:33 +0000 (16:33 +0200)
committerSebastian Neubauer <sebastian.neubauer@amd.com>
Wed, 26 May 2021 14:40:15 +0000 (16:40 +0200)
commitfcd32d62c0675abccac7b7f919bb0df52b6c4262
tree500babeb6e8ba908be58d386a4a5702ad4e64f84
parentb37a2fcd8d7c59c3db4b1c64bbdba6d1bbea9e99
[AMDGPU] Fix function pointer argument bug in AMDGPU Propagate Attributes pass.

This patch fixes a bug in the AMDGPU Propagate Attributes pass where a call
instruction with a function pointer argument is identified as a user of the
passed function, and illegally replaces the called function of the
instruction with the function argument.

For example, given functions f and g with appropriate types, the following
illegal transformation could occur without this fix:
call void @f(void ()* @g)
-->
call void @g(void ()* @g.1)

The solution introduced in this patch is to prevent the cloning and
substitution if the instruction's called function and the function which
might be cloned do not match.

Reviewed By: arsenm, madhur13490

Differential Revision: https://reviews.llvm.org/D101847
llvm/lib/Target/AMDGPU/AMDGPUPropagateAttributes.cpp
llvm/test/CodeGen/AMDGPU/propagate-attributes-function-pointer-argument.ll [new file with mode: 0644]