Skip to content

Commit

Permalink
Replace assert with raise
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasr8 committed Oct 28, 2024
1 parent a8f72ef commit 8138a06
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Tools/cases_generator/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1100,10 +1100,13 @@ def get_instruction_size_for_uop(instructions: dict[str, Instruction], uop: Uop)
if uop in inst.parts:
if size is None:
size = inst.size
assert size == inst.size, (
"All instructions containing a uop with the `INSTRUCTION_SIZE` macro "
f"must have the same size: {size} != {inst.size}"
)
if size != inst.size:
token = next(t for t in uop.body if is_instruction_size_macro(t))
raise analysis_error(
"All instructions containing a uop with the `INSTRUCTION_SIZE` macro "
f"must have the same size: {size} != {inst.size}",
token
)
if size is None:
token = next(t for t in uop.body if is_instruction_size_macro(t))
raise analysis_error(f"No instruction containing the uop '{uop.name}' was found", token)
Expand Down

0 comments on commit 8138a06

Please sign in to comment.