[llvm-commits] [llvm] r58549 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/pr2996.ll

Dan Gohman gohman at apple.com
Sat Nov 1 17:17:36 PDT 2008


Author: djg
Date: Sat Nov  1 19:17:33 2008
New Revision: 58549

URL: http://llvm.org/viewvc/llvm-project?rev=58549&view=rev
Log:
Fix this recently moved code to use the correct type. CI is now a
ConstantInt, and SI is the original cast instruction. This fixes
PR2996.

Added:
    llvm/trunk/test/Transforms/InstCombine/pr2996.ll
Modified:
    llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=58549&r1=58548&r2=58549&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Sat Nov  1 19:17:33 2008
@@ -8551,8 +8551,8 @@
           In = InsertNewInstBefore(BinaryOperator::CreateAShr(In, Sh,
                                                           In->getName()+".lobit"),
                                    *ICI);
-          if (In->getType() != CI->getType())
-            In = CastInst::CreateIntegerCast(In, CI->getType(),
+          if (In->getType() != SI.getType())
+            In = CastInst::CreateIntegerCast(In, SI.getType(),
                                              true/*SExt*/, "tmp", ICI);
     
           if (Pred == ICmpInst::ICMP_SGT)

Added: llvm/trunk/test/Transforms/InstCombine/pr2996.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/pr2996.ll?rev=58549&view=auto

==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/pr2996.ll (added)
+++ llvm/trunk/test/Transforms/InstCombine/pr2996.ll Sat Nov  1 19:17:33 2008
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | opt -instcombine
+; PR2996
+
+define void @func_53(i16 signext %p_56) nounwind {
+entry:
+	%0 = icmp sgt i16 %p_56, -1		; <i1> [#uses=1]
+	%iftmp.0.0 = select i1 %0, i32 -1, i32 0		; <i32> [#uses=1]
+	%1 = call i32 (...)* @func_4(i32 %iftmp.0.0) nounwind		; <i32> [#uses=0]
+	ret void
+}
+
+declare i32 @func_4(...)





More information about the llvm-commits mailing list