[PATCH] D37054: Require address space to be specified when creating functions (2/3)

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 2 10:12:49 PST 2018


bjope added a comment.

> Another problem I have is related to the declare construct. The test case is doing something like this:
> 
>   define %int4 @fn1 () addrspace(40) {
>   ...
>   %_tmp13 = call %int4 (%ptr6, %int4) bitcast ( %int4 (...)addrspace(40)* @fn2 to %int4 (%ptr6, %int4)addrspace(40)*)(%ptr6 %_tmp9, %int4 %_tmp12)
>   ...
>   }
>   
>   declare %int4 @fn2 (...);
> 
> 
> and I get
> 
>   error: constant expression type mismatch
>   %_tmp13 = call %int4 (%ptr6, %int4) bitcast ( %int4 (...)addrspace(40)* @fn2 to %int4 (%ptr6, %int4)addrspace(40)*)(%ptr6 %_tmp9, %int4 %_tmp12)
>                                       ^
> 
> 
> Maybe there should be an addrspace attribute on the declare statement? At the moment it does not help, because LLParser does not parse it.

What about this? How is it supposed to work? Is it supposed to work? Or is it a question for the future?
(for me it will be a question for the present, because I think our out-of-tree tests starts to fail if I merge this patch...)

I still think there are lots of test cases that should be added to verify scenarios involving functions with non-zero address space. 
The only new test case, test/Bitcode/function-nonzero-address-spaces.ll, verifies that it is possible to have a function declaration with the address space attribute.
Maybe that is all that is expected to work with this patch, or should I expect that I can have a more complete test case where I also call that function, or saves the function pointer in a variable, etc?


Repository:
  rL LLVM

https://reviews.llvm.org/D37054





More information about the llvm-commits mailing list