diff options
| author | bors <bors@rust-lang.org> | 2023-09-01 10:54:56 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-09-01 10:54:56 +0000 |
| commit | f4555ef5e14e8f0630fc5ad4e8efaef56d4acd4b (patch) | |
| tree | effb3c6b2888a0468816146264748f65c46d9407 /tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-abort.diff | |
| parent | d6b4d35d5e94f6a1577e0e645fb23afc84615a6c (diff) | |
| parent | 67553e8a11837c4b18657eedfcc272057e532bad (diff) | |
| download | rust-f4555ef5e14e8f0630fc5ad4e8efaef56d4acd4b.tar.gz rust-f4555ef5e14e8f0630fc5ad4e8efaef56d4acd4b.zip | |
Auto merge of #111752 - dingxiangfei2009:lower-or-pattern, r=cjgillot
Lower `Or` pattern without allocating place cc `@azizghuloum` `@cjgillot` Related to #111583 and #111644 While reviewing #111644, it occurs to me that while we directly lower conjunctive predicates, which are connected with `&&`, into the desirable control flow, today we don't directly lower the disjunctive predicates, which are connected with `||`, in the similar fashion. Instead, we allocate a place for the boolean temporary to hold the result of evaluating the `||` expression. Usually I would expect optimization at later stages to "inline" the evaluation of boolean predicates into simple CFG, but #111583 is an example where `&&` is failing to be optimized away and the assembly shows that both the expensive operands are evaluated. Therefore, I would like to make a small change to make the CFG a bit more straight-forward without invoking the `as_temp` machinery, and plus avoid allocating the place to hold the boolean result as well.
Diffstat (limited to 'tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-abort.diff')
| -rw-r--r-- | tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-abort.diff | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-abort.diff b/tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-abort.diff index 6174d5259d0..5242c5f6afd 100644 --- a/tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-abort.diff +++ b/tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-abort.diff @@ -32,12 +32,12 @@ bb1: { StorageDead(_6); _3 = Lt(move _4, move _5); - StorageDead(_5); - StorageDead(_4); switchInt(move _3) -> [0: bb4, otherwise: bb2]; } bb2: { + StorageDead(_5); + StorageDead(_4); StorageLive(_8); _8 = _1; _9 = Len((*_2)); @@ -52,6 +52,8 @@ } bb4: { + StorageDead(_5); + StorageDead(_4); _0 = const 42_u8; goto -> bb5; } |
