[PATCH] D136095: [GVN] Patch for invalid GVN replacement

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 28 08:45:45 PDT 2022


nikic added a comment.

Two more notes:

- It looks like https://github.com/llvm/llvm-project/commit/d4f55c0b1b878df2aa28f0df382158cb69ed9e74 was a previous attempt to fix a version of this issue.
- https://github.com/llvm/llvm-project/blob/524c640090a8463305acbafd7606f1db3c1256e2/llvm/lib/Transforms/Scalar/GVN.cpp#L2836 detects the PRE across back-edge case. It currently has an additional check on the instruction operands. If we drop that check, then that fixes the test case. The only other test this change affects is the test_shortcut_safe test from the previous point.

I think this is the correct way to fix the issue. This will prevent PRE across backedges in all cases, and avoid inserting incorrect values into the leader table.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136095/new/

https://reviews.llvm.org/D136095



More information about the llvm-commits mailing list