• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -S -loop-unroll -unroll-max-iteration-count-to-analyze=100 -unroll-threshold=10 -unroll-max-percent-threshold-boost=200 | FileCheck %s
2; RUN: opt < %s -S -passes='require<opt-remark-emit>,loop(unroll-full)' -unroll-max-iteration-count-to-analyze=100 -unroll-threshold=10 -unroll-max-percent-threshold-boost=200 | FileCheck %s
3target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
4
5; When examining gep-instructions we shouldn't consider them simplified if the
6; corresponding memory access isn't simplified. Doing the opposite might bias
7; our estimate, so that we might decide to unroll even a simple memcpy loop.
8;
9; Thus, the following loop shouldn't be unrolled:
10; CHECK-LABEL: @not_simplified_geps
11; CHECK: br i1 %
12; CHECK: ret void
13define void @not_simplified_geps(i32* noalias %b, i32* noalias %c) {
14entry:
15  br label %for.body
16
17for.body:
18  %iv.0 = phi i64 [ 0, %entry ], [ %iv.1, %for.body ]
19  %arrayidx1 = getelementptr inbounds i32, i32* %b, i64 %iv.0
20  %x1 = load i32, i32* %arrayidx1, align 4
21  %arrayidx2 = getelementptr inbounds i32, i32* %c, i64 %iv.0
22  store i32 %x1, i32* %arrayidx2, align 4
23  %iv.1 = add nuw nsw i64 %iv.0, 1
24  %exitcond = icmp eq i64 %iv.1, 10
25  br i1 %exitcond, label %for.end, label %for.body
26
27for.end:
28  ret void
29}
30