[PATCH] D51795: AMDGPU: Don't error on calls to constexpr casts of functions

Scott Linder via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 11 15:09:13 PDT 2018


scott.linder added a comment.

I still see asserts related to bitcasted function calls, but I haven't gotten to the bottom of why; an example:

  %struct.foo = type { i64, i64, i64, [104 x i8], [1 x i8] }
  %struct.pluto = type opaque
  
  define void @wombat() {
  bb:
    call void bitcast (void (%struct.foo addrspace(1)*, i64, i32, i32)* @barney to void (%struct.foo addrspace(1)*, %struct.pluto addrspace(1)*, i32, i32)*)(%struct.foo addrspace(1)* undef, %struct.pluto addrspace(1)* undef, i32 4, i32 4)
    ret void
  }
  
  define void @barney(%struct.foo addrspace(1)* nocapture %arg, i64 %arg1, i32 %arg2, i32 %arg3) {
  bb:
    ret void
  }

Results in:

  llc: llvm/lib/Target/AMDGPU/AMDGPUArgumentUsageInfo.h:164: const llvm::AMDGPUFunctionArgInfo &llvm::AMDGPUArgumentUsageInfo::lookupFuncArgInfo(const llvm::Function &) const: Assertion `F.isDeclaration()' failed.
  Stack dump:
  0.      Program arguments: llvm/bin/llc -march=amdgcn -mcpu=gfx900 meta.ll 
  1.      Running pass 'CallGraph Pass Manager' on module 'meta.ll'.
  2.      Running pass 'AMDGPU DAG->DAG Pattern Instruction Selection' on function '@wombat'
  ...
  #9 0x0000000000bc6ae5 llvm::AMDGPUArgumentUsageInfo::lookupFuncArgInfo(llvm::Function const&) const llvm/lib/Target/AMDGPU/AMDGPUArgumentUsageInfo.h:0:7
  #10 0x0000000000b8c78f llvm::SITargetLowering::passSpecialInputs(llvm::TargetLowering::CallLoweringInfo&, llvm::CCState&, llvm::SIMachineFunctionInfo const&, llvm::SmallVectorImpl<std::pair<unsigned int, llvm::SDValue> >&, llvm::SmallVectorImpl<llvm::SDValue>&, llvm::SDValue) const llvm/lib/Target/AMDGPU/SIISelLowering.cpp:2204:32
  #11 0x0000000000b8f055 llvm::SITargetLowering::LowerCall(llvm::TargetLowering::CallLoweringInfo&, llvm::SmallVectorImpl<llvm::SDValue>&) const llvm/lib/Target/AMDGPU/SIISelLowering.cpp:2573:8
  ...

However, the following gets past lowering fine:

  %struct.foo = type { i64, i64, i64, [104 x i8], [1 x i8] }
  %struct.pluto = type opaque
  
  define void @wombat() {
  bb:
    call void bitcast (void (%struct.foo addrspace(1)*, i64, i32, i32)* @barney to void (%struct.foo addrspace(1)*, %struct.pluto addrspace(1)*, i32, i32)*)(%struct.foo addrspace(1)* undef, %struct.pluto addrspace(1)* undef, i32 4, i32 4)
    ret void
  }
  
  declare void @barney(%struct.foo addrspace(1)* nocapture %arg, i64 %arg1, i32 %arg2, i32 %arg3)


https://reviews.llvm.org/D51795





More information about the llvm-commits mailing list