[PATCH] D113897: [GVNSink] Make GVNSink resistant against self referencing instructions (PR36954)

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 16 12:27:56 PST 2021


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/GVNSink.cpp:367
+                       return U == (User *)I;
+                     }) != I->users().end();
+    for (auto &U : I->uses()) {
----------------
This checks for a directly self-referential instruction, but the references may also be cyclic across multiple instructions.

As @xbolva00 mentioned, it may be simpler/cleaner to skip unreachable blocks.


================
Comment at: llvm/test/Transforms/GVNSink/sink-common-code.ll:775
+; CHECK-NOT: xor
+; PR36954 reproducer containing self referencing instruction shouldn't crash GVNSink pass.
+define void @test_pr36954() {
----------------
Can this test be further reduced?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113897



More information about the llvm-commits mailing list