2002-04-28 03:46:36 +02:00
|
|
|
; Various test cases to ensure basic functionality is working for GCSE
|
|
|
|
|
2003-09-16 17:29:54 +02:00
|
|
|
; RUN: llvm-as < %s | opt -gcse
|
2002-04-28 03:46:36 +02:00
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
void "testinsts"(int %i, int %j, int* %p)
|
|
|
|
begin
|
|
|
|
%A = cast int %i to uint
|
|
|
|
%B = cast int %i to uint
|
|
|
|
|
|
|
|
%C = shl int %i, ubyte 1
|
|
|
|
%D = shl int %i, ubyte 1
|
|
|
|
|
2003-09-08 18:29:02 +02:00
|
|
|
%E = getelementptr int* %p, long 12
|
|
|
|
%F = getelementptr int* %p, long 12
|
|
|
|
%G = getelementptr int* %p, long 13
|
2002-04-28 03:46:36 +02:00
|
|
|
ret void
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
; Test different combinations of domination properties...
|
|
|
|
void "sameBBtest"(int %i, int %j)
|
|
|
|
begin
|
|
|
|
%A = add int %i, %j
|
|
|
|
%B = add int %i, %j
|
|
|
|
|
2002-08-14 21:28:22 +02:00
|
|
|
%C = xor int %A, -1
|
|
|
|
%D = xor int %B, -1
|
|
|
|
%E = xor int %j, -1
|
2002-04-28 03:46:36 +02:00
|
|
|
|
|
|
|
ret void
|
|
|
|
end
|
|
|
|
|
|
|
|
int "dominates"(int %i, int %j)
|
|
|
|
begin
|
|
|
|
%A = add int %i, %j
|
|
|
|
br label %BB2
|
|
|
|
|
|
|
|
BB2:
|
|
|
|
%B = add int %i, %j
|
|
|
|
ret int %B
|
|
|
|
end
|
|
|
|
|
|
|
|
int "hascommondominator"(int %i, int %j)
|
|
|
|
begin
|
|
|
|
br bool true, label %BB1, label %BB2
|
|
|
|
|
|
|
|
BB1:
|
|
|
|
%A = add int %i, %j
|
|
|
|
ret int %A
|
|
|
|
|
|
|
|
BB2:
|
|
|
|
%B = add int %i, %j
|
|
|
|
ret int %B
|
|
|
|
end
|
|
|
|
|