1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00
llvm-mirror/test/Analysis/BasicAA/gcsetest.ll
David Blaikie ab043ff680 [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

llvm-svn: 230794
2015-02-27 21:17:42 +00:00

62 lines
1.3 KiB
LLVM

; Test that GCSE uses basicaa to do alias analysis, which is capable of
; disambiguating some obvious cases. All loads should be removable in
; this testcase.
; RUN: opt < %s -basicaa -gvn -instcombine -dce -S | FileCheck %s
@A = global i32 7
@B = global i32 8
; CHECK: define i32 @test()
; CHECK-NEXT: store i32 123, i32* @B
; CHECK-NEXT: ret i32 0
define i32 @test() {
%A1 = load i32, i32* @A
store i32 123, i32* @B ; Store cannot alias @A
%A2 = load i32, i32* @A
%X = sub i32 %A1, %A2
ret i32 %X
}
; CHECK: define i32 @test2()
; CHECK-NEXT: br label %Loop
; CHECK: Loop:
; CHECK-NEXT: store i32 0, i32* @B
; CHECK-NEXT: br i1 true, label %out, label %Loop
; CHECK: out:
; CHECK-NEXT: ret i32 0
define i32 @test2() {
%A1 = load i32, i32* @A
br label %Loop
Loop:
%AP = phi i32 [0, %0], [%X, %Loop]
store i32 %AP, i32* @B ; Store cannot alias @A
%A2 = load i32, i32* @A
%X = sub i32 %A1, %A2
%c = icmp eq i32 %X, 0
br i1 %c, label %out, label %Loop
out:
ret i32 %X
}
declare void @external()
; CHECK: define i32 @test3()
; CHECK-NEXT: call void @external()
; CHECK-NEXT: ret i32 7
define i32 @test3() {
%X = alloca i32
store i32 7, i32* %X
call void @external()
%V = load i32, i32* %X
ret i32 %V
}