diff options
| author | Alex Richardson <Alexander.Richardson@cl.cam.ac.uk> | 2020-01-07 12:31:18 +0000 |
|---|---|---|
| committer | Alex Richardson <Alexander.Richardson@cl.cam.ac.uk> | 2020-01-09 20:46:02 +0000 |
| commit | 646ca7d7e72e8408b3fa3472018eb9d1c2643ff5 (patch) | |
| tree | dc616c6cf286f9169bf214b4b5ee3efc8196527e /llvm/test/CodeGen/Mips | |
| parent | 1444e6e2e6f6b76cc9d5aab8b1877926aa6d5597 (diff) | |
| download | bcm5719-llvm-646ca7d7e72e8408b3fa3472018eb9d1c2643ff5.tar.gz bcm5719-llvm-646ca7d7e72e8408b3fa3472018eb9d1c2643ff5.zip | |
MipsDelaySlotFiller: Update registers def-uses for BUNDLE instructions
Summary:
In commit b91f239485fb7bb8d29be3e0b60660a2de7570a9 I updated the
MipsDelaySlotFiller to skip BUNDLE instructions.
However, in addition to not considering BUNDLE instructions for the delay
slot, we also need to ensure that the register def-use information is
updated. Not updating this information caused run-time crashes (when using
the out-of-tree CHERI backend) since later definitions could be overwritten
with earlier register values.
Reviewers: atanasyan
Reviewed By: atanasyan
Differential Revision: https://reviews.llvm.org/D72254
Diffstat (limited to 'llvm/test/CodeGen/Mips')
| -rw-r--r-- | llvm/test/CodeGen/Mips/delay-slot-filler-bundled-insts-def-use.mir | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/Mips/delay-slot-filler-bundled-insts-def-use.mir b/llvm/test/CodeGen/Mips/delay-slot-filler-bundled-insts-def-use.mir new file mode 100644 index 00000000000..fcbbfc1b5b5 --- /dev/null +++ b/llvm/test/CodeGen/Mips/delay-slot-filler-bundled-insts-def-use.mir @@ -0,0 +1,104 @@ +# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py +## Check that the delay-slot filler looks at the registers defined by BUNDLE instructions +# RUN: llc %s -run-pass=mips-delay-slot-filler -verify-machineinstrs -o - | FileCheck %s +--- | + ; ModuleID = '/Users/alex/cheri/llvm-project/llvm/test/CodeGen/Mips/delay-test.ll' + source_filename = "/Users/alex/cheri/llvm-project/llvm/test/CodeGen/Mips/delay-test.ll" + target datalayout = "E-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128" + target triple = "mips64-unknown-freebsd" + + ; Function Attrs: nounwind + define i64 @test(i1 %cond) local_unnamed_addr #0 { + entry: + br i1 %cond, label %err, label %return + + err: ; preds = %entry + unreachable + + return: ; preds = %entry + ret i64 1 + } + + attributes #0 = { nounwind } + +... +--- +name: test +alignment: 8 +exposesReturnsTwice: false +legalized: false +regBankSelected: false +selected: false +failedISel: false +tracksRegLiveness: true +hasWinCFI: false +registers: [] +liveins: + - { reg: '$a0_64', virtual-reg: '' } +frameInfo: + isFrameAddressTaken: false + isReturnAddressTaken: false + hasStackMap: false + hasPatchPoint: false + stackSize: 0 + offsetAdjustment: 0 + maxAlignment: 1 + adjustsStack: false + hasCalls: false + stackProtector: '' + maxCallFrameSize: 0 + cvBytesOfCalleeSavedRegisters: 0 + hasOpaqueSPAdjustment: false + hasVAStart: false + hasMustTailInVarArgFunc: false + localFrameSize: 0 + savePoint: '' + restorePoint: '' +fixedStack: [] +stack: [] +callSites: [] +constants: [] +machineFunctionInfo: {} +body: | + ; CHECK-LABEL: name: test + ; CHECK: bb.0.entry: + ; CHECK: successors: %bb.2(0x00000001), %bb.1(0x7fffffff) + ; CHECK: renamable $at = SLL renamable $a0, 0, implicit killed $a0_64 + ; CHECK: renamable $at = ANDi killed renamable $at, 1 + ; CHECK: $v0_64 = DADDiu $zero_64, 1 + ; CHECK: $v0_64 = DADDiu $v0_64, 1 + ; CHECK: BUNDLE implicit-def $v0_64 { + ; CHECK: $v0_64 = DADDiu $zero_64, 1 + ; CHECK: $v0_64 = DADDiu $v0_64, 1 + ; CHECK: } + ; CHECK: BNE killed renamable $at, $zero, %bb.2, implicit-def $at { + ; CHECK: NOP + ; CHECK: } + ; CHECK: bb.1.return: + ; CHECK: PseudoReturn64 undef $ra_64, implicit killed $v0_64 { + ; CHECK: NOP + ; CHECK: } + ; CHECK: bb.2.err: + bb.0.entry: + successors: %bb.1(0x00000001), %bb.2(0x7fffffff) + liveins: $a0_64 + + renamable $at = SLL renamable $a0, 0, implicit killed $a0_64 + renamable $at = ANDi killed renamable $at, 1 + ; Check that none of these instructions are hoisted after the BUNDLE to avoid + ; incorrect values from being + $v0_64 = DADDiu $zero_64, 1 + $v0_64 = DADDiu $v0_64, 1 + BUNDLE implicit-def $v0_64 { + $v0_64 = DADDiu $zero_64, 1 + $v0_64 = DADDiu $v0_64, 1 + } + BNE killed renamable $at, $zero, %bb.1, implicit-def $at + + bb.2.return: + liveins: $v0_64 + PseudoReturn64 undef $ra_64, implicit killed $v0_64 + + bb.1.err: + +... |

