xref: /aosp_15_r20/external/llvm/test/Transforms/LoopStrengthReduce/pr12018.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -loop-reduce
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32-S128"
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Worker%struct.nsTArray = type { i8 }
6*9880d681SAndroid Build Coastguard Worker%struct.nsTArrayHeader = type { i32 }
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Workerdefine void @_Z6foobarR8nsTArray(%struct.nsTArray* %aValues, i32 %foo, %struct.nsTArrayHeader* %bar) nounwind {
9*9880d681SAndroid Build Coastguard Workerentry:
10*9880d681SAndroid Build Coastguard Worker  br label %for.body
11*9880d681SAndroid Build Coastguard Worker
12*9880d681SAndroid Build Coastguard Workerfor.body:                                         ; preds = %_ZN8nsTArray9ElementAtEi.exit, %entry
13*9880d681SAndroid Build Coastguard Worker  %i.06 = phi i32 [ %add, %_ZN8nsTArray9ElementAtEi.exit ], [ 0, %entry ]
14*9880d681SAndroid Build Coastguard Worker  %call.i = call %struct.nsTArrayHeader* @_ZN8nsTArray4Hdr2Ev() nounwind
15*9880d681SAndroid Build Coastguard Worker  %add.ptr.i = getelementptr inbounds %struct.nsTArrayHeader, %struct.nsTArrayHeader* %call.i, i32 1
16*9880d681SAndroid Build Coastguard Worker  %tmp = bitcast %struct.nsTArrayHeader* %add.ptr.i to %struct.nsTArray*
17*9880d681SAndroid Build Coastguard Worker  %arrayidx = getelementptr inbounds %struct.nsTArray, %struct.nsTArray* %tmp, i32 %i.06
18*9880d681SAndroid Build Coastguard Worker  %add = add nsw i32 %i.06, 1
19*9880d681SAndroid Build Coastguard Worker  call void @llvm.dbg.value(metadata %struct.nsTArray* %aValues, i64 0, metadata !0, metadata !DIExpression()) nounwind, !dbg !DILocation(scope: !1)
20*9880d681SAndroid Build Coastguard Worker  br label %_ZN8nsTArray9ElementAtEi.exit
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Worker_ZN8nsTArray9ElementAtEi.exit:                    ; preds = %for.body
23*9880d681SAndroid Build Coastguard Worker  %arrayidx.i = getelementptr inbounds %struct.nsTArray, %struct.nsTArray* %tmp, i32 %add
24*9880d681SAndroid Build Coastguard Worker  call void @_ZN11nsTArray15ComputeDistanceERKS_Rd(%struct.nsTArray* %arrayidx, %struct.nsTArray* %arrayidx.i) nounwind
25*9880d681SAndroid Build Coastguard Worker  %cmp = icmp slt i32 %add, %foo
26*9880d681SAndroid Build Coastguard Worker  br i1 %cmp, label %for.body, label %for.end
27*9880d681SAndroid Build Coastguard Worker
28*9880d681SAndroid Build Coastguard Workerfor.end:                                          ; preds = %_ZN8nsTArray9ElementAtEi.exit
29*9880d681SAndroid Build Coastguard Worker  ret void
30*9880d681SAndroid Build Coastguard Worker}
31*9880d681SAndroid Build Coastguard Worker
32*9880d681SAndroid Build Coastguard Workerdeclare void @_ZN11nsTArray15ComputeDistanceERKS_Rd(%struct.nsTArray*, %struct.nsTArray*)
33*9880d681SAndroid Build Coastguard Worker
34*9880d681SAndroid Build Coastguard Workerdeclare %struct.nsTArrayHeader* @_ZN8nsTArray4Hdr2Ev()
35*9880d681SAndroid Build Coastguard Worker
36*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnone
37*9880d681SAndroid Build Coastguard Worker
38*9880d681SAndroid Build Coastguard Worker!0 = !DILocalVariable(scope: !1)
39*9880d681SAndroid Build Coastguard Worker!1 = distinct !DISubprogram()
40