[llvm] r310422 - [MachineOutliner] Ensure AArch64 outliner doesn't mess with W30 or LR

Alex L via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 9 01:05:03 PDT 2017


Hi Jessica,

It looks like this test fails on our expensive checks bot because of "3
machine code errors":
http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-expensive/7496/testReport/junit/LLVM/CodeGen_AArch64/machine_outliner_mir/
. Can you please take a look?

Cheers,
Alex

On 8 August 2017 at 22:51, Jessica Paquette via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: paquette
> Date: Tue Aug  8 14:51:26 2017
> New Revision: 310422
>
> URL: http://llvm.org/viewvc/llvm-project?rev=310422&view=rev
> Log:
> [MachineOutliner] Ensure AArch64 outliner doesn't mess with W30 or LR
>
> Before, the outliner would mark all instructions that read from/modify LR
> as
> illegal. This doesn't handle W30, which overlaps with LR. This shouldn't be
> outlined.
>
> This commit fixes that by making modifiesRegister() and readsRegister()
> look at
> W30 + take in a TRI argument. This makes sure that modifiesRegister() and
> readsRegister() won't outline either of W30 and LR.
>
> https://reviews.llvm.org/D36435
>
>
> Added:
>     llvm/trunk/test/CodeGen/AArch64/machine-outliner.mir
> Modified:
>     llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp
>
> Modified: llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/
> AArch64/AArch64InstrInfo.cpp?rev=310422&r1=310421&r2=310422&view=diff
> ============================================================
> ==================
> --- llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp (original)
> +++ llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp Tue Aug  8
> 14:51:26 2017
> @@ -4495,16 +4495,17 @@ AArch64InstrInfo::getOutliningType(Machi
>    if (MI.isPosition())
>      return MachineOutlinerInstrType::Illegal;
>
> +  // Don't touch the link register or W30.
> +  if (MI.readsRegister(AArch64::W30, &getRegisterInfo()) ||
> +      MI.modifiesRegister(AArch64::W30, &getRegisterInfo()))
> +    return MachineOutlinerInstrType::Illegal;
> +
>    // Make sure none of the operands are un-outlinable.
> -  for (const MachineOperand &MOP : MI.operands())
> +  for (const MachineOperand &MOP : MI.operands()) {
>      if (MOP.isCPI() || MOP.isJTI() || MOP.isCFIIndex() || MOP.isFI() ||
>          MOP.isTargetIndex())
>        return MachineOutlinerInstrType::Illegal;
> -
> -  // Don't outline anything that uses the link register.
> -  if (MI.modifiesRegister(AArch64::LR, &RI) ||
> -      MI.readsRegister(AArch64::LR, &RI))
> -    return MachineOutlinerInstrType::Illegal;
> +  }
>
>    // Does this use the stack?
>    if (MI.modifiesRegister(AArch64::SP, &RI) ||
>
> Added: llvm/trunk/test/CodeGen/AArch64/machine-outliner.mir
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/
> CodeGen/AArch64/machine-outliner.mir?rev=310422&view=auto
> ============================================================
> ==================
> --- llvm/trunk/test/CodeGen/AArch64/machine-outliner.mir (added)
> +++ llvm/trunk/test/CodeGen/AArch64/machine-outliner.mir Tue Aug  8
> 14:51:26 2017
> @@ -0,0 +1,81 @@
> +# RUN: llc -mtriple=aarch64--- -run-pass=machine-outliner %s -o - |
> FileCheck %s
> +--- |
> +  target triple = "aarch64---"
> +
> +  define i32 @main() #0 {
> +  entry:
> +    ret i32 0
> +  }
> +
> +  attributes #0 = { noinline noredzone nounwind optnone ssp uwtable }
> +
> +# CHECK-LABEL: @OUTLINED_FUNCTION_0
> +
> +...
> +---
> +# This test ensures that we
> +# - Create outlined functions
> +# - Don't outline anything to do with LR or W30
> +#
> +# CHECK-LABEL: name: main
> +# CHECK: BL @OUTLINED_FUNCTION_0
> +# CHECK: STRHHroW %w16, %x9, %w30, 1, 1
> +# CHECK: %lr = ORRXri %xzr, 1
> +# CHECK: BL @OUTLINED_FUNCTION_0
> +# CHECK: STRHHroW %w16, %x9, %w30, 1, 1
> +# CHECK: %lr = ORRXri %xzr, 1
> +# CHECK: BL @OUTLINED_FUNCTION_0
> +# CHECK: STRHHroW %w16, %x9, %w30, 1, 1
> +# CHECK: %lr = ORRXri %xzr, 1
> +name:            main
> +alignment:       2
> +tracksRegLiveness: true
> +frameInfo:
> +  stackSize:       16
> +  maxAlignment:    4
> +  maxCallFrameSize: 0
> +
> +body:             |
> +  bb.0.entry:
> +    %sp = frame-setup SUBXri %sp, 16, 0
> +    %x9 = ORRXri %xzr, 1
> +    %w16 = ORRWri %wzr, 1
> +    %w30 = ORRWri %wzr, 1
> +    %lr = ORRXri %xzr, 1
> +
> +    %w16 = ORRWri %wzr, 1
> +    %w16 = ORRWri %wzr, 1
> +    %w16 = ORRWri %wzr, 1
> +    %w16 = ORRWri %wzr, 1
> +    %w16 = ORRWri %wzr, 1
> +    %w16 = ORRWri %wzr, 1
> +    STRHHroW %w16, %x9, %w30, 1, 1
> +    %lr = ORRXri %xzr, 1
> +
> +    %w3 = ORRWri %wzr, 1993
> +
> +    %w16 = ORRWri %wzr, 1
> +    %w16 = ORRWri %wzr, 1
> +    %w16 = ORRWri %wzr, 1
> +    %w16 = ORRWri %wzr, 1
> +    %w16 = ORRWri %wzr, 1
> +    %w16 = ORRWri %wzr, 1
> +    STRHHroW %w16, %x9, %w30, 1, 1
> +    %lr = ORRXri %xzr, 1
> +
> +    %w4 = ORRWri %wzr, 1994
> +
> +    %w16 = ORRWri %wzr, 1
> +    %w16 = ORRWri %wzr, 1
> +    %w16 = ORRWri %wzr, 1
> +    %w16 = ORRWri %wzr, 1
> +    %w16 = ORRWri %wzr, 1
> +    %w16 = ORRWri %wzr, 1
> +    STRHHroW %w16, %x9, %w30, 1, 1
> +    %lr = ORRXri %xzr, 1
> +
> +    %w5 = ORRWri %wzr, 1995
> +
> +    %sp = ADDXri %sp, 16, 0
> +    RET undef %lr
> +
> \ No newline at end of file
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170809/d927ef9f/attachment.html>


More information about the llvm-commits mailing list