From 64bcc6d81e8ff51dc0da59ae5df3856fddebc93f Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Thu, 5 Jun 2014 21:29:49 +0000 Subject: [PATCH] Add a testcase where there is an overflow when combining two constants. I noticed that a proposed optimization would have prevented this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210287 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Transforms/InstCombine/add2.ll | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/Transforms/InstCombine/add2.ll b/test/Transforms/InstCombine/add2.ll index 67d560e500a..aaf3a7a235b 100644 --- a/test/Transforms/InstCombine/add2.ll +++ b/test/Transforms/InstCombine/add2.ll @@ -76,3 +76,13 @@ define <2 x i64> @test8(<2 x i64> %A) { ; CHECK-NEXT: %add = sub <2 x i64> , %A ; CHECK-NEXT: ret <2 x i64> %add } + +define i16 @test9(i16 %a) { + %b = mul i16 %a, 2 + %c = mul i16 %a, 32767 + %d = add i16 %b, %c + ret i16 %d +; CHECK-LABEL: @test9( +; CHECK-NEXT: %d = mul i16 %a, -32767 +; CHECK-NEXT: ret i16 %d +}