diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2006-12-23 06:05:41 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2006-12-23 06:05:41 +0000 |
commit | 266e42b312ab7c457d1eab01475f63e59f60933c (patch) | |
tree | 7ac7dbe9437ac2cdbbf532cacb9e043dc6f5645a /llvm/lib/Transforms/Utils/CloneFunction.cpp | |
parent | f171af97d50df7ebd7661756e89eef2295014e81 (diff) | |
download | bcm5719-llvm-266e42b312ab7c457d1eab01475f63e59f60933c.tar.gz bcm5719-llvm-266e42b312ab7c457d1eab01475f63e59f60933c.zip |
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.
llvm-svn: 32751
Diffstat (limited to 'llvm/lib/Transforms/Utils/CloneFunction.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/CloneFunction.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/CloneFunction.cpp b/llvm/lib/Transforms/Utils/CloneFunction.cpp index 3aa7397ef94..896c39943c2 100644 --- a/llvm/lib/Transforms/Utils/CloneFunction.cpp +++ b/llvm/lib/Transforms/Utils/CloneFunction.cpp @@ -278,7 +278,15 @@ void PruningFunctionCloner::CloneBlock(const BasicBlock *BB) { /// mapping its operands through ValueMap if they are available. Constant *PruningFunctionCloner:: ConstantFoldMappedInstruction(const Instruction *I) { - if (isa<BinaryOperator>(I) || isa<ShiftInst>(I)) { + if (isa<CmpInst>(I)) { + if (Constant *Op0 = dyn_cast_or_null<Constant>(MapValue(I->getOperand(0), + ValueMap))) + if (Constant *Op1 = dyn_cast_or_null<Constant>(MapValue(I->getOperand(1), + ValueMap))) + return ConstantExpr::getCompare(cast<CmpInst>(I)->getPredicate(), Op0, + Op1); + return 0; + } else if (isa<BinaryOperator>(I) || isa<ShiftInst>(I)) { if (Constant *Op0 = dyn_cast_or_null<Constant>(MapValue(I->getOperand(0), ValueMap))) if (Constant *Op1 = dyn_cast_or_null<Constant>(MapValue(I->getOperand(1), @@ -295,7 +303,7 @@ ConstantFoldMappedInstruction(const Instruction *I) { else return 0; // All operands not constant! - return ConstantFoldInstOperands(I->getOpcode(), I->getType(), Ops); + return ConstantFoldInstOperands(I, Ops); } /// CloneAndPruneFunctionInto - This works exactly like CloneFunctionInto, |