summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-08-26 22:49:59 +0000
committerChris Lattner <sabre@nondot.org>2005-08-26 22:49:59 +0000
commite7a2998064719308d67380a0dfc904665aaf0f4f (patch)
treef1e2a3aed9951fa4c06ea847fce3401abc69218b /llvm/lib/CodeGen/SelectionDAG
parentd4f43f796793c496b5be382457372b8b51648430 (diff)
downloadbcm5719-llvm-e7a2998064719308d67380a0dfc904665aaf0f4f.tar.gz
bcm5719-llvm-e7a2998064719308d67380a0dfc904665aaf0f4f.zip
Don't copy regs that are only used in the entry block into a vreg. This
changes the code generated for: short %test(short %A) { %B = xor short %A, -32768 ret short %B } to: _test: xori r2, r3, 32768 xoris r2, r2, 65535 extsh r3, r2 blr instead of: _test: rlwinm r2, r3, 0, 16, 31 xori r2, r3, 32768 xoris r2, r2, 65535 extsh r3, r2 blr llvm-svn: 23109
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index 7b8d7c549c9..c841d433c9f 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -1077,9 +1077,15 @@ LowerArguments(BasicBlock *BB, SelectionDAGLowering &SDL,
AI != E; ++AI,++a)
if (!AI->use_empty()) {
SDL.setValue(AI, Args[a]);
- SDOperand Copy =
- CopyValueToVirtualRegister(SDL, AI, FuncInfo.ValueMap[AI]);
- UnorderedChains.push_back(Copy);
+
+ if (IsOnlyUsedInOneBasicBlock(AI) == F.begin()) {
+ // Only used in the entry block, no need to copy it to a vreg for
+ // other blocks.
+ } else {
+ SDOperand Copy =
+ CopyValueToVirtualRegister(SDL, AI, FuncInfo.ValueMap[AI]);
+ UnorderedChains.push_back(Copy);
+ }
}
} else {
// Otherwise, if any argument is only accessed in a single basic block,
OpenPOWER on IntegriCloud