[PATCH] D55909: [ARM] Set Defs = [CPSR] for COPY_STRUCT_BYVAL, as it clobbers CPSR.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 20 18:19:31 PST 2018


fhahn updated this revision to Diff 179225.
fhahn retitled this revision from "[ARMISelLowering] Add CPSR to live-ins of newly created blocks, if required." to "[ARM] Set Defs = [CPSR] for COPY_STRUCT_BYVAL, as it clobbers CPSR.".
fhahn edited the summary of this revision.
fhahn added a comment.

Updated to just use Defs = [CPSR], as suggested by Eli.


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

https://reviews.llvm.org/D55909

Files:
  lib/Target/ARM/ARMInstrInfo.td
  test/CodeGen/ARM/copy-by-struct-i32.ll


Index: test/CodeGen/ARM/copy-by-struct-i32.ll
===================================================================
--- /dev/null
+++ test/CodeGen/ARM/copy-by-struct-i32.ll
@@ -0,0 +1,65 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -mtriple=armv7-unknown-linux < %s -stop-before=expand-isel-pseudos | FileCheck --check-prefix=BEFORE-EXPAND %s
+; RUN: llc -mtriple=armv7-unknown-linux < %s | FileCheck --check-prefix=ASSEMBLY %s
+
+; Check COPY_STRUCT_BYVAL_I32 has CPSR as operand.
+; BEFORE-EXPAND: COPY_STRUCT_BYVAL_I32 {{.*}} implicit-def dead $cpsr
+; BEFORE-EXPAND: COPY_STRUCT_BYVAL_I32 {{.*}} implicit-def dead $cpsr
+
+%struct.anon = type { i32, i32, i32, i32, i32, i32, i32, %struct.f, i32, i64, i32 }
+%struct.f = type { i32, i32, i32, i32, i32 }
+
+ at p = common global %struct.anon zeroinitializer, align 8
+ at q = common local_unnamed_addr global i64 0, align 8
+
+; Function Attrs: nounwind
+define arm_aapcscc void @s(i64* %q, %struct.anon* %p) local_unnamed_addr #0 {
+; ASSEMBLY-LABEL: s:
+; ASSEMBLY:       @ %bb.0: @ %entry
+; ASSEMBLY-NEXT:    push {r4, r5, r11, lr}
+; ASSEMBLY-NEXT:    sub sp, sp, #136
+; ASSEMBLY-NEXT:    ldrd r4, r5, [r0]
+; ASSEMBLY-NEXT:    add lr, sp, #56
+; ASSEMBLY-NEXT:    ldm r1, {r0, r12}
+; ASSEMBLY-NEXT:    subs r4, r4, #1
+; ASSEMBLY-NEXT:    sbc r5, r5, #0
+; ASSEMBLY-NEXT:    ldr r2, [r1, #8]
+; ASSEMBLY-NEXT:    ldr r3, [r1, #12]
+; ASSEMBLY-NEXT:    str r5, [sp, #132]
+; ASSEMBLY-NEXT:    add r5, r1, #16
+; ASSEMBLY-NEXT:    str r4, [sp, #128]
+; ASSEMBLY-NEXT:    mov r4, sp
+; ASSEMBLY-NEXT:    vld1.32 {d16}, [r5]!
+; ASSEMBLY-NEXT:    vst1.32 {d16}, [r4]!
+; ASSEMBLY-NEXT:    vld1.32 {d16}, [r5]!
+; ASSEMBLY-NEXT:    vst1.32 {d16}, [r4]!
+; ASSEMBLY-NEXT:    vld1.32 {d16}, [r5]!
+; ASSEMBLY-NEXT:    vst1.32 {d16}, [r4]!
+; ASSEMBLY-NEXT:    vld1.32 {d16}, [r5]!
+; ASSEMBLY-NEXT:    vst1.32 {d16}, [r4]!
+; ASSEMBLY-NEXT:    vld1.32 {d16}, [r5]!
+; ASSEMBLY-NEXT:    vst1.32 {d16}, [r4]!
+; ASSEMBLY-NEXT:    vld1.32 {d16}, [r5]!
+; ASSEMBLY-NEXT:    vst1.32 {d16}, [r4]!
+; ASSEMBLY-NEXT:    vld1.32 {d16}, [r5]!
+; ASSEMBLY-NEXT:    vst1.32 {d16}, [r4]!
+; ASSEMBLY-NEXT:    movw r4, #72
+; ASSEMBLY-NEXT:  .LBB0_1: @ %entry
+; ASSEMBLY-NEXT:    @ =>This Inner Loop Header: Depth=1
+; ASSEMBLY-NEXT:    vld1.32 {d16}, [r1]!
+; ASSEMBLY-NEXT:    subs r4, r4, #8
+; ASSEMBLY-NEXT:    vst1.32 {d16}, [lr]!
+; ASSEMBLY-NEXT:    bne .LBB0_1
+; ASSEMBLY-NEXT:  @ %bb.2: @ %entry
+; ASSEMBLY-NEXT:    mov r1, r12
+; ASSEMBLY-NEXT:    bl r
+; ASSEMBLY-NEXT:    add sp, sp, #136
+; ASSEMBLY-NEXT:    pop {r4, r5, r11, pc}
+entry:
+  %0 = load i64, i64* %q, align 8
+  %sub = add nsw i64 %0, -1
+  tail call arm_aapcscc void bitcast (void (...)* @r to void (%struct.anon*, %struct.anon*, i64)*)(%struct.anon* byval nonnull align 8 %p, %struct.anon* byval nonnull align 8 %p, i64 %sub)
+  ret void
+}
+
+declare arm_aapcscc void @r(...) local_unnamed_addr #1
Index: lib/Target/ARM/ARMInstrInfo.td
===================================================================
--- lib/Target/ARM/ARMInstrInfo.td
+++ lib/Target/ARM/ARMInstrInfo.td
@@ -4908,7 +4908,7 @@
   def ABS : ARMPseudoInst<(outs GPR:$dst), (ins GPR:$src), 8, NoItinerary, []>;
 }
 
-let usesCustomInserter = 1 in {
+let usesCustomInserter = 1, Defs = [CPSR] in {
     def COPY_STRUCT_BYVAL_I32 : PseudoInst<
       (outs), (ins GPR:$dst, GPR:$src, i32imm:$size, i32imm:$alignment),
       NoItinerary,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55909.179225.patch
Type: text/x-patch
Size: 3468 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181221/2c68cb5b/attachment.bin>


More information about the llvm-commits mailing list