[llvm] [InferAddressSpaces] apply InferAddressSpaces to inttoptr-zext-ptrtoint address expression. (PR #79108)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 19 07:16:57 PDT 2024
================
@@ -0,0 +1,73 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
+; RUN: opt -S -o - -passes=infer-address-spaces -assume-default-is-flat-addrspace %s | FileCheck %s
+
+target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-p7:160:256:256:32-p8:128:128-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-ni:7:8"
+
+define void @zext_ptrint_conversion(ptr addrspace(3) %x) {
+; CHECK-LABEL: define void @zext_ptrint_conversion(
+; CHECK-SAME: ptr addrspace(3) [[X:%.*]]) {
+; CHECK-NEXT: store i32 0, ptr addrspace(3) [[X]], align 4
+; CHECK-NEXT: ret void
+;
+ %tmp0 = ptrtoint ptr addrspace(3) %x to i32
+ %tmp1 = zext i32 %tmp0 to i64
+ %tmp2 = inttoptr i64 %tmp1 to ptr
+ store i32 0, ptr %tmp2
----------------
arsenm wrote:
Not no-op cast doesn't mean zero ext. This code is nonsense for AMDGPU for example
https://github.com/llvm/llvm-project/pull/79108
More information about the llvm-commits
mailing list