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