Skip to content

Commit

Permalink
Optimize exceptional iterations
Browse files Browse the repository at this point in the history
  • Loading branch information
hanno-becker committed Jul 12, 2024
1 parent 6b061ca commit 8867e41
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion slothy/core/slothy.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,12 @@ def loop_lbl_iter(i):
if self.config.sw_pipelining.unknown_iteration_count:
optimized_code += indented(self.arch.Branch.unconditional(loop_lbl_end))
for i in range(1, num_exceptional):
exceptional = i * body
c2 = c.copy()
c2.sw_pipelining.enabled = False
res = Heuristics.linear(exceptional, logger.getChild(f"exceptional_{i}"), c2)
optimized_code += [SourceLine(f"{loop_lbl_iter(i)}:")]
optimized_code += i * indented(body)
optimized_code += indented(res.code)
optimized_code += [SourceLine(f"{loop_lbl_iter(i)}_end:")]
if i != num_exceptional - 1:
optimized_code += indented(self.arch.Branch.unconditional(loop_lbl_end))
Expand Down
2 changes: 1 addition & 1 deletion slothy/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def _extract_comments_from_text(self):
return
s = list(self._raw.split("//"))
self._raw = s[0]
self._comments += map(str.strip, s[1:])
self._comments += map(str.lstrip, s[1:])
self._trim_comments()

def _extract_indentation_from_text(self):
Expand Down

0 comments on commit 8867e41

Please sign in to comment.