[llvm] 57092d4 - [Safepoint Verifier] gc.relocate does not change the constant property.

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


Author: Serguei Katkov
Date: 2022-02-15T12:18:46+07:00
New Revision: 57092d4f4f3cf2ab16f16c1419d91848fc406d69

URL: https://github.com/llvm/llvm-project/commit/57092d4f4f3cf2ab16f16c1419d91848fc406d69
DIFF: https://github.com/llvm/llvm-project/commit/57092d4f4f3cf2ab16f16c1419d91848fc406d69.diff

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

Add traverse through gc.relocate in determining whether base is
isExclusivelyDerivedFromNull OR ExclusivelyNull.

Reviewers: reames, anna
Reviewed By: reames, anna
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D119712

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/SafepointIRVerifier.cpp b/llvm/lib/IR/SafepointIRVerifier.cpp
index d8634e0ac7dd5..f77d43621ed81 100644
--- a/llvm/lib/IR/SafepointIRVerifier.cpp
+++ b/llvm/lib/IR/SafepointIRVerifier.cpp
@@ -357,6 +357,10 @@ static enum BaseType getBaseType(const Value *Val) {
       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.

diff  --git a/llvm/test/SafepointIRVerifier/hidden-constant-base.ll b/llvm/test/SafepointIRVerifier/hidden-constant-base.ll
index 446af7630b131..129e00430dc9b 100644
--- a/llvm/test/SafepointIRVerifier/hidden-constant-base.ll
+++ b/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


        


More information about the llvm-commits mailing list