summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-05-13 02:16:08 +0000
committerChris Lattner <sabre@nondot.org>2006-05-13 02:16:08 +0000
commit3987a8532da97717e272d7561f7479557b617c03 (patch)
tree286248ede07ca1f52f873ba5b2b96eaa70a0088a /llvm/lib/Transforms/Scalar/InstructionCombining.cpp
parent69a0ce62611f57b947f16c8d6c00a99cca9f538b (diff)
downloadbcm5719-llvm-3987a8532da97717e272d7561f7479557b617c03.tar.gz
bcm5719-llvm-3987a8532da97717e272d7561f7479557b617c03.zip
Add/Sub/Mul are safe to promote here as well. Incrementing a single-bit
bitfield now gives this code: _plus: lwz r2, 0(r3) rlwimi r2, r2, 0, 1, 31 xoris r2, r2, 32768 stw r2, 0(r3) blr instead of this: _plus: lwz r2, 0(r3) srwi r4, r2, 31 slwi r4, r4, 31 addis r4, r4, -32768 rlwimi r2, r4, 0, 0, 0 stw r2, 0(r3) blr this can obviously still be improved. llvm-svn: 28275
Diffstat (limited to 'llvm/lib/Transforms/Scalar/InstructionCombining.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index f25ac97ef5c..99a000fa926 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -4793,6 +4793,9 @@ static bool CanEvaluateInDifferentType(Value *V, const Type *Ty,
if (!I || !I->hasOneUse()) return false;
switch (I->getOpcode()) {
+ case Instruction::Add:
+ case Instruction::Sub:
+ case Instruction::Mul:
case Instruction::And:
case Instruction::Or:
case Instruction::Xor:
@@ -4824,6 +4827,9 @@ Value *InstCombiner::EvaluateInDifferentType(Value *V, const Type *Ty) {
Instruction *I = cast<Instruction>(V);
Instruction *Res;
switch (I->getOpcode()) {
+ case Instruction::Add:
+ case Instruction::Sub:
+ case Instruction::Mul:
case Instruction::And:
case Instruction::Or:
case Instruction::Xor: {
OpenPOWER on IntegriCloud