[llvm] r289437 - [InstCombine] add test to show PR31260 miscompile; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 12 07:28:45 PST 2016


Author: spatel
Date: Mon Dec 12 09:28:44 2016
New Revision: 289437

URL: http://llvm.org/viewvc/llvm-project?rev=289437&view=rev
Log:
[InstCombine] add test to show PR31260 miscompile; NFC

Modified:
    llvm/trunk/test/Transforms/InstCombine/narrow-switch.ll

Modified: llvm/trunk/test/Transforms/InstCombine/narrow-switch.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/narrow-switch.ll?rev=289437&r1=289436&r2=289437&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/narrow-switch.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/narrow-switch.ll Mon Dec 12 09:28:44 2016
@@ -129,3 +129,37 @@ sw.bb2:
 sw.default:
   ret void
 }
+
+; FIXME: https://llvm.org/bugs/show_bug.cgi?id=31260
+
+define i8 @PR31260(i8 %x) {
+; ALL-LABEL: @PR31260(
+; ALL-NEXT:  entry:
+; ALL-NEXT:    [[T4:%.*]] = and i8 %x, 2
+; ALL-NEXT:    switch i8 [[T4]], label %exit [
+; ALL-NEXT:    i8 -128, label %case126
+; ALL-NEXT:    i8 -126, label %case124
+; ALL-NEXT:    ]
+; ALL:       exit:
+; ALL-NEXT:    ret i8 1
+; ALL:       case126:
+; ALL-NEXT:    ret i8 3
+; ALL:       case124:
+; ALL-NEXT:    ret i8 5
+;
+entry:
+  %t4 = and i8 %x, 2
+  %t5 = add nsw i8 %t4, -126
+  switch i8 %t5, label %exit [
+  i8 -126, label %case126
+  i8 -124, label %case124
+  ]
+
+exit:
+  ret i8 1
+case126:
+  ret i8 3
+case124:
+  ret i8 5
+}
+




More information about the llvm-commits mailing list