aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-01-11 22:45:25 +0000
committerChris Lattner <sabre@nondot.org>2010-01-11 22:45:25 +0000
commit36e09c7a7596bc4a9e6675f4eecfc2390eb10933 (patch)
treecd1c296c59282e94bdfa21a20cee1162a77e1d22 /lib/Transforms
parent84793eb2bf8e94993301b024ae90f9f19fb24ae9 (diff)
downloadexternal_llvm-36e09c7a7596bc4a9e6675f4eecfc2390eb10933.zip
external_llvm-36e09c7a7596bc4a9e6675f4eecfc2390eb10933.tar.gz
external_llvm-36e09c7a7596bc4a9e6675f4eecfc2390eb10933.tar.bz2
Disable folding sext(trunc(x)) -> x (and other similar cast/cast cases) when the
trunc has multiple uses. Codegen is not able to coalesce the subreg case correctly and so this leads to higher register pressure and spilling (see PR5997). This speeds up 256.bzip2 from 8.60 -> 8.04s on my machine, ~7%. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93200 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/InstCombine/InstCombineCasts.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineCasts.cpp b/lib/Transforms/InstCombine/InstCombineCasts.cpp
index 939c2b1..b5da3e6 100644
--- a/lib/Transforms/InstCombine/InstCombineCasts.cpp
+++ b/lib/Transforms/InstCombine/InstCombineCasts.cpp
@@ -325,8 +325,11 @@ static bool CanEvaluateTruncated(Value *V, const Type *Ty) {
const Type *OrigTy = V->getType();
- // If this is an extension from the dest type, we can eliminate it.
- if ((isa<ZExtInst>(I) || isa<SExtInst>(I)) &&
+ // If this is an extension from the dest type, we can eliminate it, even if it
+ // has multiple uses.
+ // FIXME: This is currently disabled until codegen can handle this without
+ // pessimizing code, PR5997.
+ if (0 && (isa<ZExtInst>(I) || isa<SExtInst>(I)) &&
I->getOperand(0)->getType() == Ty)
return true;
@@ -606,8 +609,10 @@ static bool CanEvaluateZExtd(Value *V, const Type *Ty, unsigned &BitsToClear) {
if (!I) return false;
// If the input is a truncate from the destination type, we can trivially
- // eliminate it.
- if (isa<TruncInst>(I) && I->getOperand(0)->getType() == Ty)
+ // eliminate it, even if it has multiple uses.
+ // FIXME: This is currently disabled until codegen can handle this without
+ // pessimizing code, PR5997.
+ if (0 && isa<TruncInst>(I) && I->getOperand(0)->getType() == Ty)
return true;
// We can't extend or shrink something that has multiple uses: doing so would
@@ -853,8 +858,11 @@ static bool CanEvaluateSExtd(Value *V, const Type *Ty) {
Instruction *I = dyn_cast<Instruction>(V);
if (!I) return false;
- // If this is a truncate from the dest type, we can trivially eliminate it.
- if (isa<TruncInst>(I) && I->getOperand(0)->getType() == Ty)
+ // If this is a truncate from the dest type, we can trivially eliminate it,
+ // even if it has multiple uses.
+ // FIXME: This is currently disabled until codegen can handle this without
+ // pessimizing code, PR5997.
+ if (0 && isa<TruncInst>(I) && I->getOperand(0)->getType() == Ty)
return true;
// We can't extend or shrink something that has multiple uses: doing so would