Repository navigation
codegen: tell LLVM that the discriminant is a power of two - #162741
Conversation
This comment has been minimized.
This comment has been minimized.
00815d3 to
78443a5
Compare
This comment has been minimized.
This comment has been minimized.
78443a5 to
277091e
Compare
This comment has been minimized.
This comment has been minimized.
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
codegen: tell LLVM that the discriminant is a power of two
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (fb82f6b): comparison URL. Overall result: ❌ regressions - no action neededBenchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up. @rustbot label: -S-waiting-on-perf -perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)This perf run didn't have relevant results for this metric. CyclesResults (secondary -5.3%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (secondary -0.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 495.332s -> 496.261s (0.19%) |
277091e to
150cc4d
Compare
This comment has been minimized.
This comment has been minimized.
150cc4d to
52c6615
Compare
This comment has been minimized.
This comment has been minimized.
52c6615 to
9ca373c
Compare
|
|
|
r? @adwinwhite rustbot has assigned @adwinwhite. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
@rustbot reroll |
|
r? saethlin |
We should not disable the pattern in MatchBranchSimplification. The two forms exhaustive match and cast are equivalent, but the cast is better represented in MIR: no branches, only one statement. AFAIK, LLVM does not handle multiple disjoint intervals well. As an workaround, the patch emits `assume(ctpop(val) == 1)` to tell LLVM that the discriminant is a power of two.
9ca373c to
23fa0f4
Compare
|
@bors r=saethlin |
… r=saethlin codegen: tell LLVM that the discriminant is a power of two Fixes rust-lang#162513. We should not disable the pattern in MatchBranchSimplification. The two forms exhaustive match and cast are equivalent, but the cast is better represented in MIR: no branches, only one statement. AFAIK, LLVM does not handle multiple disjoint intervals well. As an workaround, the patch emits `assume(ctpop(val) == 1)` to tell LLVM that the discriminant is a power of two. LLM disclosure: search the codebase and fix grammer.
… r=saethlin codegen: tell LLVM that the discriminant is a power of two Fixes rust-lang#162513. We should not disable the pattern in MatchBranchSimplification. The two forms exhaustive match and cast are equivalent, but the cast is better represented in MIR: no branches, only one statement. AFAIK, LLVM does not handle multiple disjoint intervals well. As an workaround, the patch emits `assume(ctpop(val) == 1)` to tell LLVM that the discriminant is a power of two. LLM disclosure: search the codebase and fix grammer.
… r=saethlin codegen: tell LLVM that the discriminant is a power of two Fixes rust-lang#162513. We should not disable the pattern in MatchBranchSimplification. The two forms exhaustive match and cast are equivalent, but the cast is better represented in MIR: no branches, only one statement. AFAIK, LLVM does not handle multiple disjoint intervals well. As an workaround, the patch emits `assume(ctpop(val) == 1)` to tell LLVM that the discriminant is a power of two. LLM disclosure: search the codebase and fix grammer.
…uwer Rollup of 10 pull requests Successful merges: - #162741 (codegen: tell LLVM that the discriminant is a power of two) - #162758 (Split PassMode::IndirectUnsized out of PassMode::Indirect) - #163931 (Move `loop_hint_attrs` from `Terminator` into `TerminatorKind::Goto`) - #163028 (autodiff: fix sysroot candidates in libEnzyme not found error) - #163538 (Add `rustc::missing_generic_type_visitable` lint) - #163841 ([rustdoc] Fix more `incoherent_impl` linking) - #163908 (Update Enzyme submodule) - #163935 (Use BasicBlock::start_location and Location::START) - #163949 (disable next-solver with higher-ranked-assumptions) - #163951 (relax_elf_relocations is x86-only)
…uwer Rollup of 11 pull requests Successful merges: - #162741 (codegen: tell LLVM that the discriminant is a power of two) - #162758 (Split PassMode::IndirectUnsized out of PassMode::Indirect) - #163931 (Move `loop_hint_attrs` from `Terminator` into `TerminatorKind::Goto`) - #163028 (autodiff: fix sysroot candidates in libEnzyme not found error) - #163257 (abby DSL: sanity checks on forall where clauses) - #163841 ([rustdoc] Fix more `incoherent_impl` linking) - #163908 (Update Enzyme submodule) - #163935 (Use BasicBlock::start_location and Location::START) - #163949 (disable next-solver with higher-ranked-assumptions) - #163951 (relax_elf_relocations is x86-only) - #163968 (Remove needs-triage label from relnotes issues)
Rollup merge of #162741 - dianqk:codegen-discriminants-cast, r=saethlin codegen: tell LLVM that the discriminant is a power of two Fixes #162513. We should not disable the pattern in MatchBranchSimplification. The two forms exhaustive match and cast are equivalent, but the cast is better represented in MIR: no branches, only one statement. AFAIK, LLVM does not handle multiple disjoint intervals well. As an workaround, the patch emits `assume(ctpop(val) == 1)` to tell LLVM that the discriminant is a power of two. LLM disclosure: search the codebase and fix grammer.
…uwer Rollup of 11 pull requests Successful merges: - rust-lang/rust#162741 (codegen: tell LLVM that the discriminant is a power of two) - rust-lang/rust#162758 (Split PassMode::IndirectUnsized out of PassMode::Indirect) - rust-lang/rust#163931 (Move `loop_hint_attrs` from `Terminator` into `TerminatorKind::Goto`) - rust-lang/rust#163028 (autodiff: fix sysroot candidates in libEnzyme not found error) - rust-lang/rust#163257 (abby DSL: sanity checks on forall where clauses) - rust-lang/rust#163841 ([rustdoc] Fix more `incoherent_impl` linking) - rust-lang/rust#163908 (Update Enzyme submodule) - rust-lang/rust#163935 (Use BasicBlock::start_location and Location::START) - rust-lang/rust#163949 (disable next-solver with higher-ranked-assumptions) - rust-lang/rust#163951 (relax_elf_relocations is x86-only) - rust-lang/rust#163968 (Remove needs-triage label from relnotes issues)
…uwer Rollup of 11 pull requests Successful merges: - rust-lang/rust#162741 (codegen: tell LLVM that the discriminant is a power of two) - rust-lang/rust#162758 (Split PassMode::IndirectUnsized out of PassMode::Indirect) - rust-lang/rust#163931 (Move `loop_hint_attrs` from `Terminator` into `TerminatorKind::Goto`) - rust-lang/rust#163028 (autodiff: fix sysroot candidates in libEnzyme not found error) - rust-lang/rust#163257 (abby DSL: sanity checks on forall where clauses) - rust-lang/rust#163841 ([rustdoc] Fix more `incoherent_impl` linking) - rust-lang/rust#163908 (Update Enzyme submodule) - rust-lang/rust#163935 (Use BasicBlock::start_location and Location::START) - rust-lang/rust#163949 (disable next-solver with higher-ranked-assumptions) - rust-lang/rust#163951 (relax_elf_relocations is x86-only) - rust-lang/rust#163968 (Remove needs-triage label from relnotes issues)
codegen: tell LLVM that the discriminant is a power of two Fixes #162513. We should not disable the pattern in MatchBranchSimplification. The two forms exhaustive match and cast are equivalent, but the cast is better represented in MIR: no branches, only one statement. AFAIK, LLVM does not handle multiple disjoint intervals well. As an workaround, the patch emits `assume(ctpop(val) == 1)` to tell LLVM that the discriminant is a power of two. LLM disclosure: search the codebase and fix grammer.
Fixes #162513.
We should not disable the pattern in MatchBranchSimplification. The two forms exhaustive match and cast are equivalent, but the cast is better represented in MIR: no branches, only one statement.
AFAIK, LLVM does not handle multiple disjoint intervals well. As an workaround, the patch emits
assume(ctpop(val) == 1)to tell LLVM that the discriminant is a power of two.LLM disclosure: search the codebase and fix grammer.