[PATCH] D37034: Insert IMPLICIT_DEFS for undef uses in tail merging
Alberto Magni via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 2 08:07:37 PST 2018
alberto_magni added a comment.
Hi Matthias,
I have stumbled upon a problem related to this change while working on an out-of-tree target.
It reproduces with Hexagon too.
Is the insertion of the IMPLICIT_DEF legal if one of the two terminators of %bb.0 uses $r0 ?
(Here J2_jumpr uses $r0)
Consider this case:
---
name: func0
tracksRegLiveness: true
body: |
bb.0:
liveins: $r0, $r31
successors: %bb.2
J2_jumpt undef $p0, %bb.2, implicit-def $pc
J2_jumpr killed $r0, implicit-def $pc
bb.1:
liveins: $r31
successors: %bb.3
$r0 = L2_loadruh_io undef $r1, 0
PS_storerhabs 0, killed $r0
J2_jump %bb.3, implicit-def $pc
bb.2:
liveins: $r31
successors: %bb.3
PS_storerhabs 0, undef $r0
J2_jump %bb.3, implicit-def $pc
bb.3:
liveins: $r31
PS_jmpret killed $r31, implicit-def $pc
...
---
Running `llc -march=hexagon -run-pass branch-folder` gives:
body: |
bb.0:
successors: %bb.1(0x80000000)
liveins: $r0, $r31
$r0 = IMPLICIT_DEF
J2_jumpt undef $p0, %bb.1, implicit-def $pc
J2_jumpr killed $r0, implicit-def $pc
bb.1:
liveins: $r0
PS_storerhabs 0, $r0
PS_jmpret killed $r31, implicit-def $pc
...
Thus making $r0 undefined in bb.0, when originally it was not.
Thanks,
Alberto
Repository:
rL LLVM
https://reviews.llvm.org/D37034
More information about the llvm-commits
mailing list