diff options
author | Chris Lattner <sabre@nondot.org> | 2002-05-02 16:16:39 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-05-02 16:16:39 +0000 |
commit | a38ef97d0b121f6a42da0daeae3bea16b857c899 (patch) | |
tree | 7391ddffa86434dbb2cac36de607db83959cb795 /test/Transforms | |
parent | 01853e87730e232f6d39db5ed26e96067e60b943 (diff) | |
download | external_llvm-a38ef97d0b121f6a42da0daeae3bea16b857c899.zip external_llvm-a38ef97d0b121f6a42da0daeae3bea16b857c899.tar.gz external_llvm-a38ef97d0b121f6a42da0daeae3bea16b857c899.tar.bz2 |
New testcase for bug found by Vikram
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2426 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r-- | test/Transforms/LevelRaise/2002-05-02-BadCastElimination.ll | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/Transforms/LevelRaise/2002-05-02-BadCastElimination.ll b/test/Transforms/LevelRaise/2002-05-02-BadCastElimination.ll new file mode 100644 index 0000000..d78a946 --- /dev/null +++ b/test/Transforms/LevelRaise/2002-05-02-BadCastElimination.ll @@ -0,0 +1,24 @@ +; This test contains two cast instructions that cannot be eliminated. If the +; input of the "test" function is negative, it should be correctly converted +; to a 32 bit version of the number with all upper 16 bits clear (ushort->uint +; involves no sign extension). Optimizing this to a single cast is invalid! +; +; RUN: as < %s | opt -raise -q | lli -abort-on-exception +; +implementation + +uint "test"(short %argc) +begin + %cast223 = cast short %argc to ushort ; <ushort> [#uses=1] + %cast114 = cast ushort %cast223 to uint ; <uint> [#uses=1] + ret uint %cast114 +end + +int "main"() +begin + %Ret = call uint %test(short -1) + %test = cast uint %Ret to int + %Res = seteq int %test, -1 ; If it returns -1 as int, it's a failure + %Res = cast bool %Res to int + ret int %Res +end |