[all-commits] [llvm/llvm-project] 7d0648: [GVN] Patch for invalid GVN replacement

Nikita Popov via All-commits all-commits at lists.llvm.org
Fri Nov 4 06:30:59 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7d0648cb6c5f3c7377662a1211846f9fe03c474f
      https://github.com/llvm/llvm-project/commit/7d0648cb6c5f3c7377662a1211846f9fe03c474f
  Author: Alex Gatea <alexgatea at gmail.com>
  Date:   2022-11-04 (Fri, 04 Nov 2022)

  Changed paths:
    M llvm/lib/Transforms/Scalar/GVN.cpp
    A llvm/test/Transforms/GVN/PRE/load-pre-across-backedge.ll
    M llvm/test/Transforms/GVN/PRE/pre-gep-load.ll

  Log Message:
  -----------
  [GVN] Patch for invalid GVN replacement

If PRE is performed as part of the main GVN pass (to PRE GEP
operands before processing loads), and it is performed across a
backedge, we will end up adding the new instruction to the leader
table of a block that has not yet been processed. When it will be
processed, GVN will incorrectly assume that the value is already
available, even though it is only available at the end of the
block.

Avoid this by not performing PRE across backedges.

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

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




More information about the All-commits mailing list