[PATCH] D119712: [Safepoint Verifier] gc.relocate does not change the constant property.

Serguei Katkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 14 06:19:08 PST 2022


skatkov created this revision.
skatkov added reviewers: reames, anna.
Herald added subscribers: dexonsmith, hiraditya.
skatkov requested review of this revision.
Herald added a project: LLVM.

Add traverse through gc.relocate in determining whether base is constant.


https://reviews.llvm.org/D119712

Files:
  llvm/lib/IR/SafepointIRVerifier.cpp
  llvm/test/SafepointIRVerifier/hidden-constant-base.ll


Index: llvm/test/SafepointIRVerifier/hidden-constant-base.ll
===================================================================
--- llvm/test/SafepointIRVerifier/hidden-constant-base.ll
+++ llvm/test/SafepointIRVerifier/hidden-constant-base.ll
@@ -1,12 +1,7 @@
 ; RUN: opt -safepoint-ir-verifier-print-only -verify-safepoint-ir -S %s 2>&1 | FileCheck %s
 
-; This is a false positive case. Actually base of %tmp5 is null but verifier does not see that.
-; As a result it states that %tmp5 can have a unrelocated value of %tmp.
-; Relocation of %tmp is expected to be after the call to @widget but it is not required
-; due to %tmp is always null as well.
-
 ; CHECK-LABEL: Verifying gc pointers in function: test
-; CHECK: Illegal use of unrelocated value found!
+; CHECK: No illegal uses found by SafepointIRVerifier in: test
 define i8 addrspace(1)* @test(i1 %arg) gc "statepoint-example" {
 bb:
   br label %bb2
Index: llvm/lib/IR/SafepointIRVerifier.cpp
===================================================================
--- llvm/lib/IR/SafepointIRVerifier.cpp
+++ llvm/lib/IR/SafepointIRVerifier.cpp
@@ -357,6 +357,10 @@
       Worklist.push_back(SI->getFalseValue());
       continue;
     }
+    if (const auto *GCRelocate = dyn_cast<GCRelocateInst>(V)) {
+      Worklist.push_back(GCRelocate->getDerivedPtr());
+      continue;
+    }
     if (isa<Constant>(V)) {
       // We found at least one base pointer which is non-null, so this derived
       // pointer is not exclusively derived from null.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119712.408395.patch
Type: text/x-patch
Size: 1510 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220214/8d73dec6/attachment.bin>


More information about the llvm-commits mailing list