brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.1 KiB · 7c4d897 Raw
75 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt -S -mtriple=nvptx64-nvidia-cuda -passes=infer-address-spaces %s | FileCheck %s3 4%struct.S = type { [5 x i32] }5 6$g1 = comdat any7 8@g1 = linkonce_odr addrspace(3) global %struct.S zeroinitializer, comdat, align 49 10define void @foo() local_unnamed_addr #0 {11; CHECK-LABEL: @foo(12; CHECK-NEXT:  entry:13; CHECK-NEXT:    [[X0:%.*]] = tail call i32 @llvm.nvvm.read.ptx.sreg.tid.x() #[[ATTR2:[0-9]+]]14; CHECK-NEXT:    [[IDXPROM_I:%.*]] = zext i32 [[X0]] to i6415; CHECK-NEXT:    [[ARRAYIDX_I:%.*]] = getelementptr [[STRUCT_S:%.*]], ptr addrspacecast (ptr addrspace(3) @g1 to ptr), i64 0, i32 0, i64 [[IDXPROM_I]]16; CHECK-NEXT:    tail call void @f1(ptr [[ARRAYIDX_I]], i32 poison) #[[ATTR0:[0-9]+]]17; CHECK-NEXT:    [[X1:%.*]] = load i32, ptr addrspace(3) @g1, align 418; CHECK-NEXT:    [[L_SROA_0_0_INSERT_EXT_I:%.*]] = zext i32 [[X1]] to i6419; CHECK-NEXT:    tail call void @f2(ptr null, i64 [[L_SROA_0_0_INSERT_EXT_I]]) #[[ATTR0]]20; CHECK-NEXT:    ret void21;22entry:23  %x0 = tail call i32 @llvm.nvvm.read.ptx.sreg.tid.x() #224  %idxprom.i = zext i32 %x0 to i6425  %arrayidx.i = getelementptr %struct.S, ptr addrspacecast (ptr addrspace(3) @g1 to ptr), i64 0, i32 0, i64 %idxprom.i26  tail call void @f1(ptr %arrayidx.i, i32 poison) #027  %x1 = load i32, ptr addrspacecast (ptr addrspace(3) @g1 to ptr), align 428  %L.sroa.0.0.insert.ext.i = zext i32 %x1 to i6429  tail call void @f2(ptr null, i64 %L.sroa.0.0.insert.ext.i) #030  ret void31}32 33declare void @f1(ptr, i32) local_unnamed_addr #034declare void @f2(ptr, i64) local_unnamed_addr #035declare i32 @llvm.nvvm.read.ptx.sreg.tid.x() #136 37; Make sure we can clone GEP which uses complex constant expressions as indices.38; https://bugs.llvm.org/show_bug.cgi?id=5109939@g2 = internal addrspace(3) global [128 x i8] poison, align 140 41define float @complex_ce(ptr nocapture readnone %a, ptr nocapture readnone %b, ptr nocapture readnone %c) local_unnamed_addr #0 {42; CHECK-LABEL: @complex_ce(43; CHECK-NEXT:  entry:44; CHECK-NEXT:    [[TMP0:%.*]] = load float, ptr addrspace(3) getelementptr (i8, ptr addrspace(3) @g2, i64 sub (i64 ptrtoint (ptr addrspace(3) getelementptr inbounds ([128 x i8], ptr addrspace(3) @g2, i64 0, i64 123) to i64), i64 ptrtoint (ptr addrspace(3) getelementptr inbounds ([128 x i8], ptr addrspace(3) @g2, i64 2, i64 0) to i64))), align 445; CHECK-NEXT:    ret float [[TMP0]]46;47entry:48  %0 = load float, ptr bitcast (49       ptr getelementptr (50         i8, ptr addrspacecast (ptr addrspace(3) @g2 to ptr),51         i64 sub (52           i64 ptrtoint (53             ptr getelementptr inbounds (54               [128 x i8],55               ptr addrspacecast (ptr addrspace(3) @g2 to ptr),56               i64 0,57               i64 123)58             to i64),59           i64 ptrtoint (60             ptr getelementptr inbounds (61               [128 x i8],62               ptr addrspacecast (ptr addrspace(3) @g2 to ptr),63               i64 2,64               i64 0)65             to i64)))66        to ptr), align 467  ret float %068}69 70 71 72attributes #0 = { convergent nounwind }73attributes #1 = { nounwind readnone }74attributes #2 = { nounwind }75