[PATCH] D125680: Correctly legalise stackmap operands

Edd Barrett via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 24 03:32:55 PDT 2022


vext01 updated this revision to Diff 439691.
vext01 added a comment.

Updated the diff to test structs and added some more comments.

Note that structs and vectors were broken before my change, and remain broken for now.

Diff to last version:

  diff --git a/llvm/test/CodeGen/X86/selectiondag-stackmap-legalize.ll b/llvm/test/CodeGen/X86/selectiondag-stackmap-legalize.ll
  index 80d95e3b66a5..32242ac1239b 100644
  --- a/llvm/test/CodeGen/X86/selectiondag-stackmap-legalize.ll
  +++ b/llvm/test/CodeGen/X86/selectiondag-stackmap-legalize.ll
  @@ -29,7 +29,7 @@
   ;     CHECK-NEXT:   .long {{.*}}
   ;     CHECK-NEXT:   .short {{.*}}
   ;     NumLocations
  -;     CHECK-NEXT:   .short 7
  +;     CHECK-NEXT:   .short 11
   ;     Location[NumLocations]
   ;       Location[0]
   ;         CHECK-NEXT: .byte   1
  @@ -80,18 +80,50 @@
   ;         CHECK-NEXT: .short  {{.*}}
   ;         CHECK-NEXT: .short  0
   ;         CHECK-NEXT: .long   0
  +;       Location[5]
  +;         CHECK-NEXT: .byte   4
  +;         CHECK-NEXT: .byte   0
  +;         CHECK-NEXT: .short  8
  +;         CHECK-NEXT: .short  0
  +;         CHECK-NEXT: .short  0
  +;         CHECK-NEXT: .long   0
  +;       Location[6]
  +;         CHECK-NEXT: .byte   1
  +;         CHECK-NEXT: .byte   0
  +;         CHECK-NEXT: .short  4
  +;         CHECK-NEXT: .short  {{.*}}
  +;         CHECK-NEXT: .short  0
  +;         CHECK-NEXT: .long   0
  +;       Location[7]
  +;         CHECK-NEXT: .byte   4
  +;         CHECK-NEXT: .byte   0
  +;         CHECK-NEXT: .short  8
  +;         CHECK-NEXT: .short  0
  +;         CHECK-NEXT: .short  0
  +;         CHECK-NEXT: .long   0
  +;       Location[6]
  +;         CHECK-NEXT: .byte   1
  +;         CHECK-NEXT: .byte   0
  +;         CHECK-NEXT: .short  1
  +;         CHECK-NEXT: .short  {{.*}}
  +;         CHECK-NEXT: .short  0
  +;         CHECK-NEXT: .long   0
   
   @p32 = external global i8 addrspace(270)*
   
  +%struct1 = type {i32, i64}
  +%struct2 = type {i1, i1, i1}
  +
   declare void @llvm.experimental.stackmap(i64, i32, ...)
   
   define dso_local i32 @main(i32 %argc, i8** %argv) {
   entry:
     %i1reg = icmp eq i32 %argc, 5
     %i7reg = zext i1 %i1reg to i7
  -  %i128reg = zext i1 %i1reg to i128
     %halfreg = sitofp i32 %argc to half
     %ptr32 = load i8 addrspace(270)*, i8 addrspace(270)** @p32
  +  %structreg1 = insertvalue %struct1 zeroinitializer, i32 %argc, 0
  +  %structreg2 = insertvalue %struct2 zeroinitializer, i1 %i1reg, 0
     call void (i64, i32, ...) @llvm.experimental.stackmap(
       i64 0,
       i32 0,
  @@ -101,10 +133,20 @@ entry:
       half 1.0,
       half %halfreg,
       i128 66,
  +    ; FIXME: fix and test vectors. At the moment even legally sized vectors
  +    ; are broken:
  +    ; https://github.com/llvm/llvm-project/issues/55613
  +    ;
       ; FIXME: test non-constant i128 once these are fixed:
       ;  - https://github.com/llvm/llvm-project/issues/26431
       ;  - https://github.com/llvm/llvm-project/issues/55957
  -    ;i128 %i128reg
  -    i8 addrspace(270)* %ptr32)
  +    i8 addrspace(270)* %ptr32,
  +    ; FIXME: The stackmap record generated for structs is incorrect:
  +    ;  - https://github.com/llvm/llvm-project/issues/55649
  +    ;  - https://github.com/llvm/llvm-project/issues/55957
  +    %struct1 zeroinitializer,
  +    %struct1 %structreg1,
  +    %struct2 zeroinitializer,
  +    %struct2 %structreg2)
     ret i32 0
   }

Let's move this forward. Can we put this into `main`?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125680/new/

https://reviews.llvm.org/D125680

Files:
  llvm/include/llvm/CodeGen/ISDOpcodes.h
  llvm/include/llvm/CodeGen/SelectionDAGISel.h
  llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
  llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
  llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
  llvm/test/CodeGen/X86/selectiondag-stackmap-legalize.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125680.439691.patch
Type: text/x-patch
Size: 18097 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220624/3fe23fe9/attachment.bin>


More information about the llvm-commits mailing list