[all-commits] [llvm/llvm-project] 9f77e9: [GVN] Invalidate MDA when deduplicating phi nodes

Nikita Popov via All-commits all-commits at lists.llvm.org
Mon Sep 25 04:06:12 PDT 2023


  Branch: refs/heads/release/17.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 9f77e96186be77a2bd07feb0b83681f452fc967d
      https://github.com/llvm/llvm-project/commit/9f77e96186be77a2bd07feb0b83681f452fc967d
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2023-09-25 (Mon, 25 Sep 2023)

  Changed paths:
    M llvm/include/llvm/Transforms/Utils/Local.h
    M llvm/lib/Transforms/Scalar/GVN.cpp
    M llvm/lib/Transforms/Utils/Local.cpp
    A llvm/test/Transforms/GVN/pr64598.ll

  Log Message:
  -----------
  [GVN] Invalidate MDA when deduplicating phi nodes

Duplicate phi nodes were being directly removed, without
invalidating MDA. This could result in a new phi node being
allocated at the same address, incorrectly reusing a cache entry.

Fix this by optionally allowing EliminateDuplicatePHINodes() to
collect phi nodes to remove into a vector, which allows GVN to
handle removal itself.

Fixes https://github.com/llvm/llvm-project/issues/64598.

Differential Revision: https://reviews.llvm.org/D158849

(cherry picked from commit 7c229f6e85478bb0626a5e598f47b7be94bb50b0)


  Commit: 481358974fb0f732e33d503c224492a543f4d7bd
      https://github.com/llvm/llvm-project/commit/481358974fb0f732e33d503c224492a543f4d7bd
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2023-09-25 (Mon, 25 Sep 2023)

  Changed paths:
    M llvm/lib/Transforms/Scalar/GVN.cpp
    A llvm/test/Transforms/GVN/pr65447.ll

  Log Message:
  -----------
  [GVN] Also remove phi nodes from VN table (PR65447)

Followup to D158849: We also need to remove the phi node from the
VN table, which is not handled by removeInstruction().

Fixes https://github.com/llvm/llvm-project/issues/65447.

(cherry picked from commit 18e77760ce5e42d9057f69c3e64a8300d01a48ac)


Compare: https://github.com/llvm/llvm-project/compare/a13a89402f53...481358974fb0


More information about the All-commits mailing list