[clang] [OpenCL] Replace a CreatePointerCast call; NFC (PR #112676)

Youngsuk Kim via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 17 10:01:12 PDT 2024


JOE1994 wrote:

`IRBuilderBase:CreatePointerCast` doesn't emit anything if the `from` and `to` targets types are same:

https://github.com/llvm/llvm-project/blob/6d7712a70c163d2ae9e1dc928db31fcb45d9e404/llvm/include/llvm/IR/IRBuilder.h#L2197-L2204
 
while `IRBuilderBase::CreateAddrSpaceCast` emits addrspacecast regardless:

https://github.com/llvm/llvm-project/blob/6d7712a70c163d2ae9e1dc928db31fcb45d9e404/llvm/include/llvm/IR/IRBuilder.h#L2159-L2162

[LLVM LangRef says that `from` and `to` pointer types of `addrspacecast` needs to have different address spaces](https://llvm.org/docs/LangRef.html#id302)
(not sure if this is outdated info)

https://github.com/llvm/llvm-project/pull/112676


More information about the cfe-commits mailing list