From d2ae23979c7d385c11c5640832aec0c57736bcef Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 13 Aug 2003 19:01:09 +0000 Subject: Add some tests for difficult reassociation cases git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7824 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Transforms/InstCombine/add.ll | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'test/Transforms/InstCombine/add.ll') diff --git a/test/Transforms/InstCombine/add.ll b/test/Transforms/InstCombine/add.ll index d9788b99ca..a70d49065a 100644 --- a/test/Transforms/InstCombine/add.ll +++ b/test/Transforms/InstCombine/add.ll @@ -1,9 +1,6 @@ ; This test makes sure that add instructions are properly eliminated. -; -; This also tests that a subtract with a constant is properly converted -; to a add w/negative constant -; RUN: as < %s | opt -instcombine -die | dis | not grep add +; RUN: as < %s | opt -instcombine -die | dis | grep -v OK | not grep add implementation @@ -72,3 +69,27 @@ bool %test11(ubyte %A) { %c = setne ubyte %B, 0 ; === A != 1 ret bool %c } + +int %test12(int %A, int %B) { + %C_OK = add int %B, %A ; Should be transformed into shl A, 1 + br label %X +X: + %D = add int %C_OK, %A + ret int %D +} + +int %test13(int %A, int %B, int %C) { + %D_OK = add int %A, %B + %E_OK = add int %D_OK, %C + %F = add int %E_OK, %A ;; shl A, 1 + ret int %F +} + +uint %test14(uint %offset, uint %difference) { + %tmp.2 = and uint %difference, 3 + %tmp.3_OK = add uint %tmp.2, %offset + %tmp.5.mask = and uint %difference, 4294967292 + %tmp.8 = add uint %tmp.3_OK, %tmp.5.mask ; == add %offset, %difference + ret uint %tmp.8 +} + -- cgit v1.2.3