1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00
llvm-mirror/test/Analysis/ScalarEvolution/ZeroStep.ll
Michael Zolotukhin bf99505718 [SCEV] createAddRecFromPHI: Optimize for the most common case.
Summary:
The existing implementation creates a symbolic SCEV expression every
time we analyze a phi node and then has to remove it, when the analysis
is finished. This is very expensive, and in most of the cases it's also
unnecessary. According to the data I collected, ~60-70% of analyzed phi
nodes (measured on SPEC) have the following form:
  PN = phi(Start, OP(Self, Constant))
Handling such cases separately significantly speeds this up.

Reviewers: sanjoy, pete

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D32663

llvm-svn: 302096
2017-05-03 23:53:38 +00:00

19 lines
598 B
LLVM

; RUN: opt -analyze -scalar-evolution < %s -o - -S | FileCheck %s
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.9.0"
; Test that SCEV is capable of figuring out value of 'IV' that actually does not change.
; CHECK: Classifying expressions for: @foo
; CHECK: %iv.i = phi i64
; CHECK: -5 U: [-5,-4) S: [-5,-4) Exits: -5 LoopDispositions: { %loop: Invariant }
define void @foo() {
entry:
br label %loop
loop:
%iv.i = phi i64 [ -5, %entry ], [ %iv.next.i, %loop ]
%iv.next.i = add nsw i64 %iv.i, 0
br label %loop
}