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

Init canonicalize infrastructure #2

Merged
merged 81 commits into from
Oct 8, 2024
Merged

Init canonicalize infrastructure #2

merged 81 commits into from
Oct 8, 2024

Conversation

rikhuijzer
Copy link
Owner

@rikhuijzer rikhuijzer commented Sep 25, 2024

Allow canonicalization (mlir-opt tmp.mlir --canonicalize) from

module {
  func.func @test_addi(%arg0 : i64) -> i64 {
    %0 = arith.constant 1 : i64
    %1 = arith.constant 2 : i64
    %2 = arith.addi %0, %1 : i64
    %3 = arith.addi %arg0, %2 : i64
    return %3 : i64
  }
}

to

module {
  func.func @test_addi(%arg0 : i64) -> i64 {
    %0 = arith.constant 1 : i64
    %1 = arith.constant 2 : i64
    %2 = arith.constant 3 : i64
    %3 = arith.addi %arg0, %2 : i64
    return %3 : i64
  }
}

So, it applied const prop to %2.

Next step

The next step is to do dead code elimination in order to transform the code to

module {
  func.func @test_addi(%arg0: i64) -> i64 {
    %c3_i64 = arith.constant 3 : i64
    %0 = arith.addi %arg0, %c3_i64 : i64
    return %0 : i64
  }
}

@rikhuijzer rikhuijzer merged commit 9ed2c8e into main Oct 8, 2024
2 checks passed
@rikhuijzer rikhuijzer deleted the rh/init-canonicalize branch October 8, 2024 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant