2002-04-28 01:46:36 +00:00
|
|
|
; Various test cases to ensure basic functionality is working for GCSE
|
|
|
|
|
2008-03-01 09:15:35 +00:00
|
|
|
; RUN: llvm-as < %s | opt -gcse
|
|
|
|
|
|
|
|
define void @testinsts(i32 %i, i32 %j, i32* %p) {
|
|
|
|
%A = bitcast i32 %i to i32 ; <i32> [#uses=0]
|
|
|
|
%B = bitcast i32 %i to i32 ; <i32> [#uses=0]
|
|
|
|
%C = shl i32 %i, 1 ; <i32> [#uses=0]
|
|
|
|
%D = shl i32 %i, 1 ; <i32> [#uses=0]
|
|
|
|
%E = getelementptr i32* %p, i64 12 ; <i32*> [#uses=0]
|
|
|
|
%F = getelementptr i32* %p, i64 12 ; <i32*> [#uses=0]
|
|
|
|
%G = getelementptr i32* %p, i64 13 ; <i32*> [#uses=0]
|
|
|
|
ret void
|
|
|
|
}
|
2002-04-28 01:46:36 +00:00
|
|
|
|
|
|
|
; Test different combinations of domination properties...
|
2008-03-01 09:15:35 +00:00
|
|
|
define void @sameBBtest(i32 %i, i32 %j) {
|
|
|
|
%A = add i32 %i, %j ; <i32> [#uses=1]
|
|
|
|
%B = add i32 %i, %j ; <i32> [#uses=1]
|
|
|
|
%C = xor i32 %A, -1 ; <i32> [#uses=0]
|
|
|
|
%D = xor i32 %B, -1 ; <i32> [#uses=0]
|
|
|
|
%E = xor i32 %j, -1 ; <i32> [#uses=0]
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @dominates(i32 %i, i32 %j) {
|
|
|
|
%A = add i32 %i, %j ; <i32> [#uses=0]
|
|
|
|
br label %BB2
|
|
|
|
|
|
|
|
BB2: ; preds = %0
|
|
|
|
%B = add i32 %i, %j ; <i32> [#uses=1]
|
|
|
|
ret i32 %B
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @hascommondominator(i32 %i, i32 %j) {
|
|
|
|
br i1 true, label %BB1, label %BB2
|
|
|
|
|
|
|
|
BB1: ; preds = %0
|
|
|
|
%A = add i32 %i, %j ; <i32> [#uses=1]
|
|
|
|
ret i32 %A
|
|
|
|
|
|
|
|
BB2: ; preds = %0
|
|
|
|
%B = add i32 %i, %j ; <i32> [#uses=1]
|
|
|
|
ret i32 %B
|
|
|
|
}
|
2002-04-28 01:46:36 +00:00
|
|
|
|