cleancode(pto): clean up static-analysis warnings and decompose large verifiers - #1371
Merged
Merged
Conversation
Contributor
Author
|
/run a3 |
|
已接收
页面会自动刷新,可以直接看当前阶段、排队情况和最近结果。 |
A3 板测完成(有跳过)
|
Address safe and moderate lint findings without altering behavior: - add missing braces, fix lambda default capture, order includes - replace forward declarations with the corresponding includes where no include cycle exists - drop the redundant ASSERT macro in favor of assert - replace magic numbers with named constants (kBitsPerByte, kMaxSupportedBitWidth, kNumVPTOSchedulingClasses, existing kValueN) False-positive findings are intentionally left in place: CAPI export markers, self-referential forward declarations, and forward decls that break header include cycles.
Mechanically split the five largest Op::verify() methods in PTO.cpp into file-scope static helpers, each under the 50 nbnc-line huge_method threshold. Behavior-preserving extraction only: check order, error strings, and magic numbers are all preserved verbatim. Verifiers decomposed: TMovOp, TExtractOp, TGatherOp, TInsertOp, TQuantMxOp. Verified on remote LLVM 19 toolchain: libPTOIR.a compiles clean under strict -Werror, and the pto lit suite is identical before/after this change (697/700 pass; the same 3 pre-existing failures in struct_escape and plan_memory_fusion are unrelated to these verifiers).
…warnings Mechanically extract TScatterOp, SubViewOp, TQuantOp, TTransOp, and TPReluOp verify() methods into focused file-scope static helpers, each under 50 nbnc lines. Behavior-preserving: error strings, magic numbers, and check ordering are all preserved verbatim.
…warnings Mechanically extract TMrgSortOp, TCvtOp, TSelSOp, TConcatOp, and TRemOp verify() methods into focused file-scope static helpers, each under 50 nbnc lines. Behavior-preserving: error strings, magic numbers, and check ordering are all preserved verbatim.
…warnings Mechanically extract TGatherBOp, TRemSOp, TPowOp, TPowSOp, and TSelOp verify() methods into focused file-scope static helpers, each under 50 nbnc lines. Behavior-preserving: error strings, magic numbers, and check ordering are all preserved verbatim.
…warnings Mechanically extract file-scope static helpers from the following Op::verify() methods, preserving all error strings, magic numbers, and check ordering (behavior-preserving): - TPartMulOp -> verifyTPartMulA2A3/A5 - TRowExpandAddOp -> verifyTRowExpandAddCore/Src1/ByArch - TXorOp -> verifyTXorA2A3/A5 - TRowExpandOp -> verifyTRowExpandCommon - TPartAddOp -> verifyTPartAddA2A3/A5
The verifier decomposition dropped the braces on many single-statement if bodies to shave lines toward the huge_method threshold, which violates G.FMT.11-CPP (if/for/while bodies must be braced). Re-add braces to every control body the decomposition introduced (~292 if bodies), leaving pre-existing untouched code alone. Purely structural: no logic change. Remote build is clean and the pto lit suite is unchanged (697/700; same 3 pre-existing environmental failures).
A3 板测完成(有跳过)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Clean up static-analysis findings in the PTO IR layer without altering
any behavior. Two independent, behavior-preserving efforts:
1. General lint cleanup
Address safe and moderate lint findings:
no include cycle exists
kMaxSupportedBitWidth, kNumVPTOSchedulingClasses, existing kValueN)
False-positive findings are intentionally left in place: CAPI export
markers, self-referential forward declarations, and forward decls that
break header include cycles.
2. huge_method decomposition (25 verifiers, 5 batches)
Mechanically split the largest
Op::verify()methods inPTO.cppintofocused file-scope static helpers, each under the 50 nbnc-line
huge_method threshold. Behavior-preserving extraction only: check order,
error strings, and magic numbers are all preserved verbatim. No ODS /
API / semantic changes — pure C++ verifier refactor.
Verification
Each batch was verified on the remote LLVM 19 toolchain:
libPTOIR.acompiles clean, and the pto lit suite is identical before/after every
batch (697/700 pass; the same 3 pre-existing failures in
struct_escape_return_invalid,struct_escape_yield_invalid, andplan_memory_fusion_region_aliasare environmental and unrelated tothese changes). Identical failure sets across all batches = zero
regressions.