[PATCH] D112911: Fix the side effect of outlined function when register is implicit and implicit-def
DianQK via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 13 04:04:53 PST 2021
DianQK marked an inline comment as done.
DianQK added a comment.
In D112911#3128737 <https://reviews.llvm.org/D112911#3128737>, @jinlin wrote:
> 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. So the fix does serve this purpose.
>
> 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
Yes, we should do is to check whether implict-def and implict use of $x0 are in the same instruction or not.
================
Comment at: llvm/test/CodeGen/AArch64/machine-outliner-side-effect-2.mir:19
$x1 = ADDXri $sp, 16, 0
- BL @spam, csr_darwin_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit $x0, implicit killed $x1, implicit-def $sp, implicit-def dead $x0
+ BL @spam, csr_darwin_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit $x0, implicit killed $x1, implicit-def $sp, implicit-def $x0
+ renamable $x1 = COPY $x0
----------------
jinlin wrote:
> Why do you need to change this test file? With this fix, $x0 should be marked as use.
I wanted to show that this has nothing to do with the dead attribute, which is unnecessary and has been removed.
================
Comment at: llvm/test/CodeGen/AArch64/machine-outliner-side-effect-2.mir:19
$x1 = ADDXri $sp, 16, 0
- BL @spam, csr_darwin_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit $x0, implicit killed $x1, implicit-def $sp, implicit-def dead $x0
+ BL @spam, csr_darwin_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit $x0, implicit killed $x1, implicit-def $sp, implicit-def $x0
+ renamable $x1 = COPY $x0
----------------
DianQK wrote:
> jinlin wrote:
> > Why do you need to change this test file? With this fix, $x0 should be marked as use.
> I wanted to show that this has nothing to do with the dead attribute, which is unnecessary and has been removed.
> Why do you need to change this test file? With this fix, $x0 should be marked as use.
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