; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
; RUN: opt -passes=indvars -S < %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-G1-ni:7:8:9"
target triple = "amdgcn--amdpal"
define void @f(ptr addrspace(7) %arg) {
; CHECK-LABEL: define void @f
; CHECK-SAME: (ptr addrspace(7) [[ARG:%.*]]) {
; CHECK-NEXT: bb:
; CHECK-NEXT: br label [[BB1:%.*]]
; CHECK: bb1:
; CHECK-NEXT: br i1 false, label [[BB2:%.*]], label [[BB1]]
; CHECK: bb2:
; CHECK-NEXT: [[SCEVGEP:%.*]] = getelementptr i8, ptr addrspace(7) [[ARG]], i32 8
; CHECK-NEXT: br label [[BB3:%.*]]
; CHECK: bb3:
; CHECK-NEXT: [[I4:%.*]] = load i32, ptr addrspace(7) [[SCEVGEP]], align 4
; CHECK-NEXT: br label [[BB3]]
;
bb:
br label %bb1
bb1:
%i = getelementptr i32, ptr addrspace(7) %arg, i32 2
br i1 false, label %bb2, label %bb1
bb2:
br label %bb3
bb3:
%i4 = load i32, ptr addrspace(7) %i, align 4
br label %bb3
}
define void @f2(<2 x ptr addrspace(7)> %arg) {
; CHECK-LABEL: define void @f2
; CHECK-SAME: (<2 x ptr addrspace(7)> [[ARG:%.*]]) {
; CHECK-NEXT: bb:
; CHECK-NEXT: br label [[BB1:%.*]]
; CHECK: bb1:
; CHECK-NEXT: [[P:%.*]] = extractelement <2 x ptr addrspace(7)> [[ARG]], i32 0
; CHECK-NEXT: [[I:%.*]] = getelementptr i32, ptr addrspace(7) [[P]], i32 2
; CHECK-NEXT: br i1 false, label [[BB2:%.*]], label [[BB1]]
; CHECK: bb2:
; CHECK-NEXT: [[I_LCSSA:%.*]] = phi ptr addrspace(7) [ [[I]], [[BB1]] ]
; CHECK-NEXT: br label [[BB3:%.*]]
; CHECK: bb3:
; CHECK-NEXT: [[I4:%.*]] = load i32, ptr addrspace(7) [[I_LCSSA]], align 4
; CHECK-NEXT: br label [[BB3]]
;
bb:
br label %bb1
bb1:
%p = extractelement <2 x ptr addrspace(7)> %arg, i32 0
%i = getelementptr i32, ptr addrspace(7) %p, i32 2
br i1 false, label %bb2, label %bb1
bb2:
br label %bb3
bb3:
%i4 = load i32, ptr addrspace(7) %i, align 4
br label %bb3
}