diff options
| author | Duncan Sands <baldrick@free.fr> | 2010-12-21 15:03:43 +0000 |
|---|---|---|
| committer | Duncan Sands <baldrick@free.fr> | 2010-12-21 15:03:43 +0000 |
| commit | fecc642224432166ca89f10d0d047ed07520b792 (patch) | |
| tree | a8a24542d9e0459b54ed19b11c10a052c7367796 /llvm/lib/Analysis | |
| parent | 5def0d67914c1570d91164a30a9b65dac2948434 (diff) | |
| download | bcm5719-llvm-fecc642224432166ca89f10d0d047ed07520b792.tar.gz bcm5719-llvm-fecc642224432166ca89f10d0d047ed07520b792.zip | |
While I don't think any later transforms can fire, it seems cleaner to
not assume this (for example in case more transforms get added below
it). Suggested by Frits van Bommel.
llvm-svn: 122332
Diffstat (limited to 'llvm/lib/Analysis')
| -rw-r--r-- | llvm/lib/Analysis/InstructionSimplify.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp index 157193d5d36..f35d50586e7 100644 --- a/llvm/lib/Analysis/InstructionSimplify.cpp +++ b/llvm/lib/Analysis/InstructionSimplify.cpp @@ -492,7 +492,8 @@ static Value *SimplifyAddInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW, /// i1 add -> xor. if (MaxRecurse && Op0->getType()->isIntegerTy(1)) - return SimplifyXorInst(Op0, Op1, TD, DT, MaxRecurse-1); + if (Value *V = SimplifyXorInst(Op0, Op1, TD, DT, MaxRecurse-1)) + return V; // Try some generic simplifications for associative operations. if (Value *V = SimplifyAssociativeBinOp(Instruction::Add, Op0, Op1, TD, DT, @@ -555,7 +556,8 @@ static Value *SimplifySubInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW, /// i1 sub -> xor. if (MaxRecurse && Op0->getType()->isIntegerTy(1)) - return SimplifyXorInst(Op0, Op1, TD, DT, MaxRecurse-1); + if (Value *V = SimplifyXorInst(Op0, Op1, TD, DT, MaxRecurse-1)) + return V; // Mul distributes over Sub. Try some generic simplifications based on this. if (Value *V = FactorizeBinOp(Instruction::Sub, Op0, Op1, Instruction::Mul, @@ -608,7 +610,8 @@ static Value *SimplifyMulInst(Value *Op0, Value *Op1, const TargetData *TD, /// i1 mul -> and. if (MaxRecurse && Op0->getType()->isIntegerTy(1)) - return SimplifyAndInst(Op0, Op1, TD, DT, MaxRecurse-1); + if (Value *V = SimplifyAndInst(Op0, Op1, TD, DT, MaxRecurse-1)) + return V; // Try some generic simplifications for associative operations. if (Value *V = SimplifyAssociativeBinOp(Instruction::Mul, Op0, Op1, TD, DT, |

