summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-03-05 18:50:12 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-03-05 18:50:12 +0000
commit71b9b6be1bca11f35172b8bef128ca76959dfd08 (patch)
tree99beafcedfac89ed43fd975023dfd0fceeff84e9 /llvm
parentcaf7444b801133f8615491aadb28dc508a15ef3d (diff)
downloadbcm5719-llvm-71b9b6be1bca11f35172b8bef128ca76959dfd08.tar.gz
bcm5719-llvm-71b9b6be1bca11f35172b8bef128ca76959dfd08.zip
X86: Optimize address mode matching for FRAME_ALLOC_RECOVER nodes
We know that the absolute symbol will be less than 2GB and thus will always fit. llvm-svn: 231389
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp1
-rw-r--r--llvm/lib/Target/X86/X86ISelDAGToDAG.cpp9
-rw-r--r--llvm/test/CodeGen/X86/frameescape.ll8
3 files changed, 14 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
index 17eff944c62..5898da41c7f 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
@@ -95,6 +95,7 @@ std::string SDNode::getOperationName(const SelectionDAG *G) const {
case ISD::GLOBAL_OFFSET_TABLE: return "GLOBAL_OFFSET_TABLE";
case ISD::RETURNADDR: return "RETURNADDR";
case ISD::FRAMEADDR: return "FRAMEADDR";
+ case ISD::FRAME_ALLOC_RECOVER: return "FRAME_ALLOC_RECOVER";
case ISD::READ_REGISTER: return "READ_REGISTER";
case ISD::WRITE_REGISTER: return "WRITE_REGISTER";
case ISD::FRAME_TO_ARGS_OFFSET: return "FRAME_TO_ARGS_OFFSET";
diff --git a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
index 8d50ae1584e..42715562a7c 100644
--- a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
+++ b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
@@ -1004,6 +1004,15 @@ bool X86DAGToDAGISel::MatchAddressRecursively(SDValue N, X86ISelAddressMode &AM,
switch (N.getOpcode()) {
default: break;
+ case ISD::FRAME_ALLOC_RECOVER: {
+ if (!AM.hasSymbolicDisplacement())
+ if (const auto *ESNode = dyn_cast<ExternalSymbolSDNode>(N.getOperand(0)))
+ if (ESNode->getOpcode() == ISD::TargetExternalSymbol) {
+ AM.ES = ESNode->getSymbol();
+ return false;
+ }
+ break;
+ }
case ISD::Constant: {
uint64_t Val = cast<ConstantSDNode>(N)->getSExtValue();
if (!FoldOffsetIntoAddress(Val, AM))
diff --git a/llvm/test/CodeGen/X86/frameescape.ll b/llvm/test/CodeGen/X86/frameescape.ll
index 621dbe2d276..b48672d3808 100644
--- a/llvm/test/CodeGen/X86/frameescape.ll
+++ b/llvm/test/CodeGen/X86/frameescape.ll
@@ -16,20 +16,20 @@ define void @print_framealloc_from_fp(i8* %fp) {
%b = bitcast i8* %b.i8 to i32*
%b.val = load i32, i32* %b
call i32 (i8*, ...)* @printf(i8* getelementptr ([10 x i8]* @str, i32 0, i32 0), i32 %b.val)
+ store i32 42, i32* %b
ret void
}
; CHECK-LABEL: print_framealloc_from_fp:
; CHECK: movq %rcx, %[[parent_fp:[a-z]+]]
-; CHECK: movabsq $.Lalloc_func$frame_escape_0, %[[offs:[a-z]+]]
-; CHECK: movl (%[[parent_fp]],%[[offs]]), %edx
+; CHECK: movl .Lalloc_func$frame_escape_0(%[[parent_fp]]), %edx
; CHECK: leaq {{.*}}(%rip), %[[str:[a-z]+]]
; CHECK: movq %[[str]], %rcx
; CHECK: callq printf
-; CHECK: movabsq $.Lalloc_func$frame_escape_1, %[[offs:[a-z]+]]
-; CHECK: movl (%[[parent_fp]],%[[offs]]), %edx
+; CHECK: movl .Lalloc_func$frame_escape_1(%[[parent_fp]]), %edx
; CHECK: movq %[[str]], %rcx
; CHECK: callq printf
+; CHECK: movl $42, .Lalloc_func$frame_escape_1(%[[parent_fp]])
; CHECK: retq
define void @alloc_func() {
OpenPOWER on IntegriCloud