diff options
author | Chris Lattner <sabre@nondot.org> | 2002-08-15 16:13:29 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-08-15 16:13:29 +0000 |
commit | 8decbcbbfe0587826d2adae04f83fea2e2575832 (patch) | |
tree | 7de0d8a7c50ba6c3308b9f70d8fbf12862583435 /test | |
parent | 917d5519695281f3eb4248cf81863ebf121111d8 (diff) | |
download | external_llvm-8decbcbbfe0587826d2adae04f83fea2e2575832.zip external_llvm-8decbcbbfe0587826d2adae04f83fea2e2575832.tar.gz external_llvm-8decbcbbfe0587826d2adae04f83fea2e2575832.tar.bz2 |
Add a bunch of testcases for cast-of-casts that should be removed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3345 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Transforms/InstCombine/cast.ll | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/cast.ll b/test/Transforms/InstCombine/cast.ll index 5aa6368..a809fc4 100644 --- a/test/Transforms/InstCombine/cast.ll +++ b/test/Transforms/InstCombine/cast.ll @@ -25,3 +25,35 @@ ulong %test3(ulong %A) { ; This function should just use bitwise AND %c2 = cast ubyte %c1 to ulong ret ulong %c2 } + +uint %test4(int %A, int %B) { + %COND = setlt int %A, %B + %c = cast bool %COND to ubyte ; Booleans are unsigned integrals + %result = cast ubyte %c to uint ; for the cast elim purpose + ret uint %result +} + +int %test5(bool %B) { + %c = cast bool %B to ubyte ; This cast should get folded into + %result = cast ubyte %c to int ; this cast + ret int %result +} + +int %test6(ulong %A) { + %c1 = cast ulong %A to uint + %res = cast uint %c1 to int + ret int %res +} + +long %test7(bool %A) { + %c1 = cast bool %A to int + %res = cast int %c1 to long + ret long %res +} + +long %test8(sbyte %A) { + %c1 = cast sbyte %A to ulong + %res = cast ulong %c1 to long + ret long %res +} + |