[PATCH] D112911: Fix the side effect of outlined function when register is implicit and implicit-def

Jin Lin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 12 16:01:42 PST 2021


jinlin added a comment.

Here is the output of first iteration machine outliner.
llc -march=arm64 -run-pass=machine-outliner -machine-outliner-reruns=0 --simplify-mir -verify-machineinstrs build/example.mir -o build/example.outlined.mir0

The implicit use of $x0 for outlined function OUTLINED_FUNCTION_1 is missing in this case.  What we should do is to check whether implict-def and implict use of $x0 are in the same instruction or not. If so, we should ignore the implict-def.

before:

  $x1 = MOVZXi 0, 0
  BL @needx0, csr_darwin_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit $x0, implicit killed $x1, implicit-def $sp, implicit-def $x0
  renamable $w0 = nsw ADDWri renamable $w0, 2, 0, implicit killed $x0 

After:

  frame-setup CFI_INSTRUCTION offset $w29, -16 
  BL @OUTLINED_FUNCTION_1, implicit-def $lr, implicit $sp, implicit-def $lr, implicit-def $sp, implicit-def $x0, implicit-def $x1, implicit $sp
  renamable $x0 = nsw ADDXri killed renamable $x0, 1, 0

name:            OUTLINED_FUNCTION_1

body:             |

  bb.0:
    liveins: $d15, $x19, $x20, $x21, $x22, $x23, $x24, $x25, $x26, $x27, $x28, $d8, $d9, $d10, $d11, $d12, $d13, $d14, $x0
   
    $x1 = MOVZXi 0, 0
    TCRETURNdi @needx0, 0, implicit $sp


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112911



More information about the llvm-commits mailing list