[all-commits] [llvm/llvm-project] 2e9f86: Reland "[LLVM] Add IRNormalizer Pass" (#113780)

Justin Fargnoli via All-commits all-commits at lists.llvm.org
Thu Nov 14 09:56:44 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2e9f8696e9533fdd464e025bd504302fa1a22f14
      https://github.com/llvm/llvm-project/commit/2e9f8696e9533fdd464e025bd504302fa1a22f14
  Author: Justin Fargnoli <justinfargnoli at gmail.com>
  Date:   2024-11-14 (Thu, 14 Nov 2024)

  Changed paths:
    M llvm/docs/Passes.rst
    M llvm/docs/ReleaseNotes.md
    A llvm/include/llvm/Transforms/Utils/IRNormalizer.h
    M llvm/lib/Passes/PassBuilder.cpp
    M llvm/lib/Passes/PassRegistry.def
    M llvm/lib/Transforms/Utils/CMakeLists.txt
    A llvm/lib/Transforms/Utils/IRNormalizer.cpp
    A llvm/test/Transforms/IRNormalizer/naming-args-instr-blocks.ll
    A llvm/test/Transforms/IRNormalizer/naming-arguments.ll
    A llvm/test/Transforms/IRNormalizer/naming.ll
    A llvm/test/Transforms/IRNormalizer/regression-convergence-tokens.ll
    A llvm/test/Transforms/IRNormalizer/regression-coro-elide-musttail.ll
    A llvm/test/Transforms/IRNormalizer/regression-deoptimize.ll
    A llvm/test/Transforms/IRNormalizer/regression-dont-hoist-deoptimize.ll
    A llvm/test/Transforms/IRNormalizer/regression-infinite-loop.ll
    A llvm/test/Transforms/IRNormalizer/reordering-basic.ll
    A llvm/test/Transforms/IRNormalizer/reordering.ll

  Log Message:
  -----------
  Reland "[LLVM] Add IRNormalizer Pass" (#113780)

`IRNormalizer` will reorder instructions. Thus, we need to invalidate
analyses. Done in cd500d28cba3177c213f2f2faf50f14ea56e230b. This should
resolve the [BuildBot
failure](https://github.com/llvm/llvm-project/pull/68176#issuecomment-2428243474).

---

Original PR: #68176
Original commit: 1295d2e6da2fe90f3b770ab1d35bf5caecd38bed
Reverted with: 8a12e0131f3d84b470fac63af042aa96a1b19f56

---

Add the llvm-canon tool. Description from the [original
PR](https://reviews.llvm.org/D66029#change-wZv3yOpDdxIu):

> Added a new llvm-canon tool which aims to transform LLVM Modules into
a canonical form by reordering and renaming instructions while
preserving the same semantics. This tool makes it easier to spot
semantic differences while diffing two modules which have undergone
different transformation passes.

The current version of this tool can:

- Reorder instructions within a function.
- Rename instructions based on the operands.
- Sort commutative operands.

This code was originally written by @michalpaszkowski and [submitted to
mainline
LLVM](https://github.com/llvm/llvm-project/commit/14d358537f124a732adad1ec6edf3981dc9baece).
However, it was quickly
[reverted](https://github.com/llvm/llvm-project/commit/335de55fa3384946f1e62050f2545c0966163236)
to do BuildBot errors.

Michal presented his version of the tool in [LLVM-Canon: Shooting for
Clear Diffs](https://www.youtube.com/watch?v=c9WMijSOEUg).

@AidanGoldfarb and I ported the code to the new pass manager, added more
tests, and fixed some bugs related to PHI nodes that may have been the
root cause of the BuildBot errors that caused the patch to be reverted.
Additionally, we rewrote the implementation of instruction reordering to
fix cases where the original algorithm would break use-def chains.

Note that this is @AidanGoldfarb and I's first time submitting to LLVM.
Please liberally critique the PR!

CC @plotfi for initial review.

---------

Co-authored-by: Aidan <aidan.goldfarb at mail.mcgill.ca>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list