[llvm] r231389 - X86: Optimize address mode matching for FRAME_ALLOC_RECOVER nodes
David Majnemer
david.majnemer at gmail.com
Thu Mar 5 10:50:13 PST 2015
Author: majnemer
Date: Thu Mar 5 12:50:12 2015
New Revision: 231389
URL: http://llvm.org/viewvc/llvm-project?rev=231389&view=rev
Log:
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.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
llvm/trunk/test/CodeGen/X86/frameescape.ll
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp?rev=231389&r1=231388&r2=231389&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp Thu Mar 5 12:50:12 2015
@@ -95,6 +95,7 @@ std::string SDNode::getOperationName(con
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";
Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=231389&r1=231388&r2=231389&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Thu Mar 5 12:50:12 2015
@@ -1004,6 +1004,15 @@ bool X86DAGToDAGISel::MatchAddressRecurs
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))
Modified: llvm/trunk/test/CodeGen/X86/frameescape.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/frameescape.ll?rev=231389&r1=231388&r2=231389&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/frameescape.ll (original)
+++ llvm/trunk/test/CodeGen/X86/frameescape.ll Thu Mar 5 12:50:12 2015
@@ -16,20 +16,20 @@ define void @print_framealloc_from_fp(i8
%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() {
More information about the llvm-commits
mailing list