mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-21 20:12:56 +02:00
ab043ff680
Essentially the same as the GEP change in r230786. A similar migration script can be used to update test cases, though a few more test case improvements/changes were required this time around: (r229269-r229278) import fileinput import sys import re pat = re.compile(r"((?:=|:|^)\s*load (?:atomic )?(?:volatile )?(.*?))(| addrspace\(\d+\) *)\*($| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$)") for line in sys.stdin: sys.stdout.write(re.sub(pat, r"\1, \2\3*\4", line)) Reviewers: rafael, dexonsmith, grosser Differential Revision: http://reviews.llvm.org/D7649 llvm-svn: 230794
43 lines
1.6 KiB
LLVM
43 lines
1.6 KiB
LLVM
; RUN: opt -S -indvars < %s | FileCheck %s
|
|
|
|
define void @test1(float* nocapture %autoc, float* nocapture %data, float %d, i32 %data_len, i32 %sample) nounwind {
|
|
entry:
|
|
%sub = sub i32 %data_len, %sample
|
|
%cmp4 = icmp eq i32 %data_len, %sample
|
|
br i1 %cmp4, label %for.end, label %for.body
|
|
|
|
for.body: ; preds = %entry, %for.body
|
|
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
|
|
%0 = trunc i64 %indvars.iv to i32
|
|
%add = add i32 %0, %sample
|
|
%idxprom = zext i32 %add to i64
|
|
%arrayidx = getelementptr inbounds float, float* %data, i64 %idxprom
|
|
%1 = load float, float* %arrayidx, align 4
|
|
%mul = fmul float %1, %d
|
|
%arrayidx2 = getelementptr inbounds float, float* %autoc, i64 %indvars.iv
|
|
%2 = load float, float* %arrayidx2, align 4
|
|
%add3 = fadd float %2, %mul
|
|
store float %add3, float* %arrayidx2, align 4
|
|
%indvars.iv.next = add i64 %indvars.iv, 1
|
|
%3 = trunc i64 %indvars.iv.next to i32
|
|
%cmp = icmp ult i32 %3, %sub
|
|
br i1 %cmp, label %for.body, label %for.end
|
|
|
|
for.end: ; preds = %for.body, %entry
|
|
ret void
|
|
|
|
; CHECK-LABEL: @test1(
|
|
|
|
; First check that we move the sub into the preheader, it doesn't have to be
|
|
; executed if %cmp4 == false
|
|
; CHECK: for.body.preheader:
|
|
; CHECK: sub i32 %data_len, %sample
|
|
; CHECK: br label %for.body
|
|
|
|
; Second, check that we turn the IV test into an eq.
|
|
; CHECK: %lftr.wideiv = trunc i64 %indvars.iv.next to i32
|
|
; CHECK: %exitcond = icmp ne i32 %lftr.wideiv, %0
|
|
; CHECK: br i1 %exitcond, label %for.body, label %for.end.loopexit
|
|
}
|
|
|