[PATCH] D127744: freeze does not change the constant property
Danila Malyutin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 14 09:53:46 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3b54aa9eab82: freeze does not change the constant property (authored by danilaml).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127744/new/
https://reviews.llvm.org/D127744
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,8 +1,8 @@
-; RUN: opt -safepoint-ir-verifier-print-only -verify-safepoint-ir -S %s 2>&1 | FileCheck %s
+; RUN: opt -safepoint-ir-verifier-print-only -passes='verify<safepoint-ir>' -S %s 2>&1 | FileCheck %s
; CHECK-LABEL: Verifying gc pointers in function: test
-; CHECK: No illegal uses found by SafepointIRVerifier in: test
-define i8 addrspace(1)* @test(i1 %arg) gc "statepoint-example" {
+; CHECK: No illegal uses found by SafepointIRVerifier in: test_gc_relocate
+define i8 addrspace(1)* @test_gc_relocate(i1 %arg) gc "statepoint-example" {
bb:
br label %bb2
@@ -25,6 +25,20 @@
br i1 %arg, label %bb4, label %bb2
}
+; CHECK-LABEL: Verifying gc pointers in function: test
+; CHECK: No illegal uses found by SafepointIRVerifier in: test_freeze_inst
+define void @test_freeze_inst(i32* %ptr) gc "statepoint-example" {
+entry:
+ br label %loop
+
+loop:
+ %vptr = phi i8 addrspace(1)* [ %fptr, %loop ], [ undef, %entry ]
+ %fptr = freeze i8 addrspace(1)* %vptr
+ %statepoint_token = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* elementtype(void ()) undef, i32 0, i32 0, i32 0, i32 0) [ "deopt"(i8 addrspace(1)* %fptr), "gc-live"(i8 addrspace(1)* %fptr) ]
+ %fptr.relocated = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token %statepoint_token, i32 0, i32 0) ; (%fptr, %fptr)
+ br label %loop
+}
+
declare void @widget()
declare i1 @baz()
Index: llvm/lib/IR/SafepointIRVerifier.cpp
===================================================================
--- llvm/lib/IR/SafepointIRVerifier.cpp
+++ llvm/lib/IR/SafepointIRVerifier.cpp
@@ -363,6 +363,11 @@
Worklist.push_back(GCRelocate->getDerivedPtr());
continue;
}
+ if (const auto *FI = dyn_cast<FreezeInst>(V)) {
+ // Freeze does not change null-ness or constant-ness of the value.
+ Worklist.push_back(FI->getOperand(0));
+ 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: D127744.436830.patch
Type: text/x-patch
Size: 2358 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220614/894d8c29/attachment.bin>
More information about the llvm-commits
mailing list