optimize a common idiom generated by clang for bitfield access, PR2638.
[oota-llvm.git] / test / Transforms / InstCombine / sext-misc.ll
index 69850025aca289ef5a20621b2100035aee260227..58749666ea1b50b435432f344814b40ef366f943 100644 (file)
@@ -63,3 +63,13 @@ F:
        ret i16 %W
 }
 
+; PR2638
+define i32 @test2(i32 %i) nounwind  {
+entry:
+        %tmp12 = trunc i32 %i to i8             ; <i8> [#uses=1]
+        %tmp16 = shl i8 %tmp12, 6               ; <i8> [#uses=1]
+        %a = ashr i8 %tmp16, 6            ; <i8> [#uses=1]
+        %b = sext i8 %a to i32            ; <i32> [#uses=1]
+        ret i32 %b
+}
+