[llvm] r357742 - [FastISel] Fix crash for gc.relocate lowring
Serguei Katkov via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 4 22:41:08 PDT 2019
Author: skatkov
Date: Thu Apr 4 22:41:08 2019
New Revision: 357742
URL: http://llvm.org/viewvc/llvm-project?rev=357742&view=rev
Log:
[FastISel] Fix crash for gc.relocate lowring
Lowering safepoint checks that all gc.relocaes observed in safepoint
must be lowered. However Fast-Isel is able to skip dead gc.relocate.
To resolve this issue we just ignore dead gc.relocate in the check.
Reviewers: reames
Reviewed By: reames
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D60184
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/StatepointLowering.h
llvm/trunk/test/CodeGen/X86/fast-isel-gc-intrinsics.ll
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/StatepointLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/StatepointLowering.h?rev=357742&r1=357741&r2=357742&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/StatepointLowering.h (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/StatepointLowering.h Thu Apr 4 22:41:08 2019
@@ -66,13 +66,18 @@ public:
/// before the next statepoint. If we don't see it, we'll report
/// an assertion.
void scheduleRelocCall(const CallInst &RelocCall) {
- PendingGCRelocateCalls.push_back(&RelocCall);
+ // We are not interested in lowering dead instructions.
+ if (!RelocCall.use_empty())
+ PendingGCRelocateCalls.push_back(&RelocCall);
}
/// Remove this gc_relocate from the list we're expecting to see
/// before the next statepoint. If we weren't expecting to see
/// it, we'll report an assertion.
void relocCallVisited(const CallInst &RelocCall) {
+ // We are not interested in lowering dead instructions.
+ if (RelocCall.use_empty())
+ return;
auto I = llvm::find(PendingGCRelocateCalls, &RelocCall);
assert(I != PendingGCRelocateCalls.end() &&
"Visited unexpected gcrelocate call");
Modified: llvm/trunk/test/CodeGen/X86/fast-isel-gc-intrinsics.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fast-isel-gc-intrinsics.ll?rev=357742&r1=357741&r2=357742&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/fast-isel-gc-intrinsics.ll (original)
+++ llvm/trunk/test/CodeGen/X86/fast-isel-gc-intrinsics.ll Thu Apr 4 22:41:08 2019
@@ -29,6 +29,8 @@ entry:
%safepoint_token = tail call token (i64, i32, i1 ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_i1f(i64 0, i32 0, i1 ()* @return_i1, i32 0, i32 0, i32 0, i32 0, i8 addrspace(1)* %v)
%call1 = call zeroext i1 @llvm.experimental.gc.result.i1(token %safepoint_token)
%vnew = call i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token %safepoint_token, i32 7, i32 7)
+ br label %exit
+exit:
ret i1 %call1
}
More information about the llvm-commits
mailing list