[llvm-commits] [llvm] r92775 - in /llvm/trunk: lib/Transforms/InstCombine/InstCombineCasts.cpp test/Transforms/InstCombine/sub.ll

Chris Lattner sabre at nondot.org
Tue Jan 5 13:16:30 PST 2010


Author: lattner
Date: Tue Jan  5 15:16:30 2010
New Revision: 92775

URL: http://llvm.org/viewvc/llvm-project?rev=92775&view=rev
Log:
just remove this xform which is subsumed by others.

Modified:
    llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp
    llvm/trunk/test/Transforms/InstCombine/sub.ll

Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp?rev=92775&r1=92774&r2=92775&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp Tue Jan  5 15:16:30 2010
@@ -680,32 +680,7 @@
     Value *V2 = ConstantExpr::getTrunc(ShAmtV, DestTy);
     return BinaryOperator::CreateShl(V1, V2);
   }
-  
-  // If we are discarding information from a simple binop, rewrite.
-  if (Src->hasOneUse() && isa<Instruction>(Src)) {
-    Instruction *SrcI = cast<Instruction>(Src);
-    switch (SrcI->getOpcode()) {
-    default: break;
-    case Instruction::Add:
-    // TODO: SUB?
-    case Instruction::Mul:
-    case Instruction::And:
-    case Instruction::Or:
-    case Instruction::Xor:
-      Value *Op0 = SrcI->getOperand(0);
-      Value *Op1 = SrcI->getOperand(1);
-
-      // Don't insert two casts unless at least one can be eliminated.
-      if (!ValueRequiresCast(Instruction::Trunc, Op1, DestTy) ||
-          !ValueRequiresCast(Instruction::Trunc, Op0, DestTy)) {
-        Op0 = Builder->CreateTrunc(Op0, DestTy, Op0->getName());
-        Op1 = Builder->CreateTrunc(Op1, DestTy, Op1->getName());
-        return BinaryOperator::Create(cast<BinaryOperator>(SrcI)->getOpcode(),
-                                      Op0, Op1);
-      }
-    }
-  }
- 
+
   return 0;
 }
 

Modified: llvm/trunk/test/Transforms/InstCombine/sub.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/sub.ll?rev=92775&r1=92774&r2=92775&view=diff

==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/sub.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/sub.ll Tue Jan  5 15:16:30 2010
@@ -223,8 +223,8 @@
   %G = sub i32 %D, %F
   ret i32 %G
 ; CHECK: @test23
-; CHECK: %A1 = trunc i64 %A to i32
-; CHECK: ret i32 %A1
+; CHECK-NEXT: = trunc i64 %A to i32
+; CHECK-NEXT: ret i32
 }
 
 define i64 @test24(i8* %P, i64 %A){





More information about the llvm-commits mailing list