diff options
| author | bors <bors@rust-lang.org> | 2025-01-22 04:18:30 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-01-22 04:18:30 +0000 |
| commit | b2728d5426bab1d8c39709768c7e22b7f66dde5d (patch) | |
| tree | 87bf763b2ee84e7cb3c243efa7a43aa4595a024c /compiler/rustc_parse_format | |
| parent | c234b839d1681a7aa3abb1bda6f6f350714eacfe (diff) | |
| parent | 6fe82006a4edf2d244f436aa7d14d985d0b1f39a (diff) | |
| download | rust-b2728d5426bab1d8c39709768c7e22b7f66dde5d.tar.gz rust-b2728d5426bab1d8c39709768c7e22b7f66dde5d.zip | |
Auto merge of #135674 - scottmcm:assume-better, r=estebank
Update our range `assume`s to the format that LLVM prefers I found out in https://github.com/llvm/llvm-project/issues/123278#issuecomment-2597440158 that the way I started emitting the `assume`s in #109993 was suboptimal, and as seen in that LLVM issue the way we're doing it -- with two `assume`s sometimes -- can at times lead to CVP/SCCP not realize what's happening because one of them turns into a `ne` instead of conveying a range. So this updates how it's emitted from ``` assume( x >= LOW ); assume( x <= HIGH ); ``` or ``` // (for ranges that wrap the range) assume( (x <= LOW) | (x >= HIGH) ); ``` to ``` assume( (x - LOW) <= (HIGH - LOW) ); ``` so that we don't need multiple `icmp`s nor multiple `assume`s for a single value, and both wrappping and non-wrapping ranges emit the same shape. (And we don't bother emitting the subtraction if `LOW` is zero, since that's trivial for us to check too.)
Diffstat (limited to 'compiler/rustc_parse_format')
0 files changed, 0 insertions, 0 deletions
