aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar/Reassociate.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2006-12-23 06:05:41 +0000
committerReid Spencer <rspencer@reidspencer.com>2006-12-23 06:05:41 +0000
commite4d87aa2de6e52952dca73716386db09aad5a8fd (patch)
treece8c6e6ddc845de3585020c856118892f4206593 /lib/Transforms/Scalar/Reassociate.cpp
parentadd2bd7f5941537a97a41e037ae2277fbeed0b4f (diff)
For PR950:
This patch removes the SetCC instructions and replaces them with the ICmp and FCmp instructions. The SetCondInst instruction has been removed and been replaced with ICmpInst and FCmpInst. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32751 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/Reassociate.cpp')
-rw-r--r--lib/Transforms/Scalar/Reassociate.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/Transforms/Scalar/Reassociate.cpp b/lib/Transforms/Scalar/Reassociate.cpp
index 69805f86ba..dab2d2e306 100644
--- a/lib/Transforms/Scalar/Reassociate.cpp
+++ b/lib/Transforms/Scalar/Reassociate.cpp
@@ -95,10 +95,11 @@ namespace {
FunctionPass *llvm::createReassociatePass() { return new Reassociate(); }
void Reassociate::RemoveDeadBinaryOp(Value *V) {
- BinaryOperator *BOp = dyn_cast<BinaryOperator>(V);
- if (!BOp || !BOp->use_empty()) return;
+ Instruction *Op = dyn_cast<Instruction>(V);
+ if (!Op || !isa<BinaryOperator>(Op) || !isa<CmpInst>(Op) || !Op->use_empty())
+ return;
- Value *LHS = BOp->getOperand(0), *RHS = BOp->getOperand(1);
+ Value *LHS = Op->getOperand(0), *RHS = Op->getOperand(1);
RemoveDeadBinaryOp(LHS);
RemoveDeadBinaryOp(RHS);
}
@@ -755,7 +756,7 @@ void Reassociate::ReassociateBB(BasicBlock *BB) {
}
// Reject cases where it is pointless to do this.
- if (!isa<BinaryOperator>(BI) || BI->getType()->isFloatingPoint() ||
+ if (!isa<BinaryOperator>(BI) || BI->getType()->isFloatingPoint() ||
isa<PackedType>(BI->getType()))
continue; // Floating point ops are not associative.