Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scf-for-loop-range-folding does not multiply lower bound #83482

Closed
superlopuh opened this issue Feb 29, 2024 · 0 comments · Fixed by #111875
Closed

scf-for-loop-range-folding does not multiply lower bound #83482

superlopuh opened this issue Feb 29, 2024 · 0 comments · Fixed by #111875
Labels

Comments

@superlopuh
Copy link
Contributor

Minimal example:

func.func private @foo(index) -> ()

%c0 = arith.constant 0 : index
%c1 = arith.constant 1 : index
%c2 = arith.constant 2 : index
%c3 = arith.constant 3 : index
%c6 = arith.constant 6 : index

scf.for %i = %c1 to %c6 step %c2 {
    %val = arith.muli %i, %c3 : index
    func.call @foo(%val) : (index) -> ()
}

// mlir-opt --scf-for-loop-range-folding --canonicalize

func.func private @foo(index)

%c6 = arith.constant 6 : index
%c18 = arith.constant 18 : index
%c1 = arith.constant 1 : index

scf.for %arg0 = %c1 to %c18 step %c6 {
  func.call @foo(%arg0) : (index) -> ()
}

In Python syntax:

a = [i * 3 for i in range(1, 6, 2)]
b = list(range(3, 18, 6))

Both a and b are [3, 9, 15]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants