diff options
| author | cheneym2 <acheney@nvidia.com> | 2025-01-14 11:22:04 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-14 08:22:04 -0800 |
| commit | 4da52b65ac04251ab52d713fa28146f76a84446c (patch) | |
| tree | fff3710a934dc704dc185bd78f45a998cba393d0 /docs/user-guide | |
| parent | 9a926058f45c7adfa569946b4f6b15a8772ac035 (diff) | |
Fix simplify if-else (#6077)
* Fix simplify if-else
The if-else optimization observes that at if at least one
true/false block is merely an unconditional jump to the
after block, that the whole if-else can be replaced with
a jump to the after block. But it's important to copy
the phi arguments from the aforementioned unconditional
jump, rather than what is present in the 'true' block,
since the 'true' block might actually just be the after
block itself.
Below, the ifElse() would be replaced with an unconditional
jump to block %39, but with the `phi` arguments copied from
the branch to %29, which is an unrelated block.
ifElse(%38, %39, %40, %39)
block %40:
unconditionalBranch(%39)
block %39:
unconditionalBranch(%29, 0 : Float)
block %29(
[nameHint("ret")]
param %ret : Float):
Fixes issue #5972
* format code
---------
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'docs/user-guide')
0 files changed, 0 insertions, 0 deletions
