Fix Transforms/InstCombine/2004-12-08-RemInfiniteLoop.ll
authorChris Lattner <sabre@nondot.org>
Wed, 8 Dec 2004 22:20:34 +0000 (22:20 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 8 Dec 2004 22:20:34 +0000 (22:20 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18670 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/InstructionCombining.cpp

index 8915598da115137715daa87d47b151e8464f4056..9eb30549f47b58dbbc842bd19783e02cac478fc8 100644 (file)
@@ -309,7 +309,8 @@ static inline Value *dyn_castNegVal(Value *V) {
 
   // Constants can be considered to be negated values if they can be folded...
   if (Constant *C = dyn_cast<Constant>(V))
-    return ConstantExpr::getNeg(C);
+    if (!isa<UndefValue>(C))
+      return ConstantExpr::getNeg(C);
   return 0;
 }