llvm-6502/test/Transforms/GVN/cond_br.ll
David Blaikie 7c9c6ed761 [opaque pointer type] Add textual IR support for explicit type parameter to load instruction
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230794 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-27 21:17:42 +00:00

56 lines
1.5 KiB
LLVM

; RUN: opt -basicaa -gvn -S < %s | FileCheck %s
@y = external global i32
@z = external global i32
; Function Attrs: nounwind ssp uwtable
define void @foo(i32 %x) {
; CHECK: @foo(i32 %x)
; CHECK: %.pre = load i32, i32* @y
; CHECK: call void @bar(i32 %.pre)
%t = sub i32 %x, %x
%.pre = load i32, i32* @y, align 4
%cmp = icmp sgt i32 %t, 2
br i1 %cmp, label %if.then, label %entry.if.end_crit_edge
entry.if.end_crit_edge: ; preds = %entry
br label %if.end
if.then: ; preds = %entry
%add = add nsw i32 %x, 3
store i32 %add, i32* @y, align 4
br label %if.end
if.end: ; preds = %entry.if.end_crit_edge, %if.then
%1 = phi i32 [ %.pre, %entry.if.end_crit_edge ], [ %add, %if.then ]
tail call void @bar(i32 %1)
ret void
}
define void @foo2(i32 %x) {
; CHECK: @foo2(i32 %x)
; CHECK: %.pre = load i32, i32* @y
; CHECK: tail call void @bar(i32 %.pre)
entry:
%t = sub i32 %x, %x
%.pre = load i32, i32* @y, align 4
%cmp = icmp sgt i32 %t, 2
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%add = add nsw i32 %x, 3
store i32 %add, i32* @y, align 4
br label %if.end
if.else: ; preds = %entry
store i32 1, i32* @z, align 4
br label %if.end
if.end: ; preds = %if.else, %if.then
%0 = phi i32 [ %.pre, %if.else ], [ %add, %if.then ]
tail call void @bar(i32 %0)
ret void
}
declare void @bar(i32)