[llvm] r210287 - Add a testcase where there is an overflow when combining two constants.

Rafael Espindola rafael.espindola at gmail.com
Thu Jun 5 14:29:49 PDT 2014


Author: rafael
Date: Thu Jun  5 16:29:49 2014
New Revision: 210287

URL: http://llvm.org/viewvc/llvm-project?rev=210287&view=rev
Log:
Add a testcase where there is an overflow when combining two constants.

I noticed that a proposed optimization would have prevented this.

Modified:
    llvm/trunk/test/Transforms/InstCombine/add2.ll

Modified: llvm/trunk/test/Transforms/InstCombine/add2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/add2.ll?rev=210287&r1=210286&r2=210287&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/add2.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/add2.ll Thu Jun  5 16:29:49 2014
@@ -76,3 +76,13 @@ define <2 x i64> @test8(<2 x i64> %A) {
 ; CHECK-NEXT: %add = sub <2 x i64> <i64 1, i64 2>, %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
+}





More information about the llvm-commits mailing list