[llvm] 3e738af - [Statepoint Lowering] Allow other than N byte sized types in deopt bundle
Yevgeny Rouban via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 7 03:49:34 PDT 2021
Author: Yevgeny Rouban
Date: 2021-04-07T17:48:31+07:00
New Revision: 3e738afae4b5994b3f5e4fc6f7249083fc470df5
URL: https://github.com/llvm/llvm-project/commit/3e738afae4b5994b3f5e4fc6f7249083fc470df5
DIFF: https://github.com/llvm/llvm-project/commit/3e738afae4b5994b3f5e4fc6f7249083fc470df5.diff
LOG: [Statepoint Lowering] Allow other than N byte sized types in deopt bundle
I do not see any bit-width restriction from the point of the
LLVM Lang Ref - Operand Bundles on the types of the deopt bundle
operands. Statepoint Lowering seems to be able to work with any
types.
This patch relaxes the two related assertions and adds a new test
for this change.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D100006
Added:
llvm/test/CodeGen/X86/statepoint-spill-slot-size-promotion.ll
Modified:
llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
index 5f796e06fcb2..9d80e7a1222e 100644
--- a/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
@@ -113,7 +113,9 @@ StatepointLoweringState::allocateStackSlot(EVT ValueType,
MachineFrameInfo &MFI = Builder.DAG.getMachineFunction().getFrameInfo();
unsigned SpillSize = ValueType.getStoreSize();
- assert((SpillSize * 8) == ValueType.getSizeInBits() && "Size not in bytes?");
+ assert((SpillSize * 8) ==
+ (-8u & (7 + ValueType.getSizeInBits())) && // Round up modulo 8.
+ "Size not in bytes?");
// First look for a previously created stack slot which is not in
// use (accounting for the fact arbitrary slots may already be
@@ -386,7 +388,8 @@ spillIncomingStatepointValue(SDValue Incoming, SDValue Chain,
// (i.e. change the '==' in the assert below to a '>=').
MachineFrameInfo &MFI = Builder.DAG.getMachineFunction().getFrameInfo();
assert((MFI.getObjectSize(Index) * 8) ==
- (int64_t)Incoming.getValueSizeInBits() &&
+ (-8 & (7 + // Round up modulo 8.
+ (int64_t)Incoming.getValueSizeInBits())) &&
"Bad spill: stack slot does not match!");
// Note: Using the alignment of the spill slot (rather than the abi or
diff --git a/llvm/test/CodeGen/X86/statepoint-spill-slot-size-promotion.ll b/llvm/test/CodeGen/X86/statepoint-spill-slot-size-promotion.ll
new file mode 100644
index 000000000000..2388ea8ccd29
--- /dev/null
+++ b/llvm/test/CodeGen/X86/statepoint-spill-slot-size-promotion.ll
@@ -0,0 +1,54 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py then fixed by hand.
+; RUN: llc -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK
+;
+; Test
diff erent type sizes of deop bundle operands.
+;
+target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-pc-win64"
+
+define i1 @test_spill_slot_size(i1 %a1, i2 %a2, i7 %a7, i8 %a8, i9 %a9, i15 %a15, i16 %a16, i32 %a32, i64 %a64, i128 %a128, i32 addrspace(1)* %obj1) gc "statepoint-example" {
+; CHECK-LABEL: test_spill_slot_size:
+; CHECK: # %bb.0: # %entry
+; CHECK-NEXT: pushq %rbx
+; CHECK-NEXT: .cfi_def_cfa_offset 16
+; CHECK-NEXT: subq $32, %rsp
+; CHECK-NEXT: .cfi_def_cfa_offset 48
+; CHECK-NEXT: .cfi_offset %rbx, -16
+; CHECK-NEXT: movl %edi, %ebx
+; CHECK-NEXT: movq {{[0-9]+}}(%rsp), %r10
+; CHECK-NEXT: movq {{[0-9]+}}(%rsp), %r11
+; CHECK-NEXT: movl {{[0-9]+}}(%rsp), %eax
+; CHECK-NEXT: movzwl {{[0-9]+}}(%rsp), %edi
+; CHECK-NEXT: movw %di, {{[0-9]+}}(%rsp)
+; CHECK-NEXT: movl %eax, {{[0-9]+}}(%rsp)
+; CHECK-NEXT: movq %r11, {{[0-9]+}}(%rsp)
+; CHECK-NEXT: movq %r10, {{[0-9]+}}(%rsp)
+; CHECK-NEXT: movb %cl, {{[0-9]+}}(%rsp)
+; CHECK-NEXT: andb $3, %sil
+; CHECK-NEXT: movb %sil, {{[0-9]+}}(%rsp)
+; CHECK-NEXT: movl %ebx, %eax
+; CHECK-NEXT: andl $1, %eax
+; CHECK-NEXT: movb %al, {{[0-9]+}}(%rsp)
+; CHECK-NEXT: andb $127, %dl
+; CHECK-NEXT: movb %dl, {{[0-9]+}}(%rsp)
+; CHECK-NEXT: andl $511, %r8d # imm = 0x1FF
+; CHECK-NEXT: movw %r8w, {{[0-9]+}}(%rsp)
+; CHECK-NEXT: andl $32767, %r9d # imm = 0x7FFF
+; CHECK-NEXT: movw %r9w, {{[0-9]+}}(%rsp)
+; CHECK-NEXT: movabsq $140727162896504, %rax # imm = 0x7FFD988E0078
+; CHECK-NEXT: callq *%rax
+; CHECK-NEXT: .Ltmp0:
+; CHECK-NEXT: movl %ebx, %eax
+; CHECK-NEXT: addq $32, %rsp
+; CHECK-NEXT: .cfi_def_cfa_offset 16
+; CHECK-NEXT: popq %rbx
+; CHECK-NEXT: .cfi_def_cfa_offset 8
+; CHECK-NEXT: retq
+
+entry:
+ %safepoint_token = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* inttoptr (i64 140727162896504 to void ()*), i32 0, i32 0, i32 0, i32 0)
+ [ "deopt"(i1 %a1, i2 %a2, i7 %a7, i8 %a8, i9 %a9, i15 %a15, i16 %a16, i32 %a32, i64 %a64, i128 %a128, i32 addrspace(1)* %obj1) ]
+ ret i1 %a1
+}
+
+declare token @llvm.experimental.gc.statepoint.p0f_isVoidf(i64, i32, void ()*, i32, i32, ...)
More information about the llvm-commits
mailing list