[PATCH] D60184: [FastISel] Fix crash for gc.relocate lowring

Serguei Katkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 3 01:10:59 PDT 2019


skatkov created this revision.
skatkov added a reviewer: reames.

All gc.relocate intrinsics corresponding to statepoint must be lowered.
Howevet if gc.relocate instruction is dead one it will be skipped by fast isel and
as a result an assert will be fired.


https://reviews.llvm.org/D60184

Files:
  lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
  test/CodeGen/X86/fast-isel-gc-intrinsics.ll


Index: test/CodeGen/X86/fast-isel-gc-intrinsics.ll
===================================================================
--- test/CodeGen/X86/fast-isel-gc-intrinsics.ll
+++ test/CodeGen/X86/fast-isel-gc-intrinsics.ll
@@ -29,6 +29,8 @@
   %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
 }
 
Index: lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
===================================================================
--- lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -1254,7 +1254,8 @@
          !I->isTerminator() &&     // Terminators aren't folded.
          !isa<DbgInfoIntrinsic>(I) &&  // Debug instructions aren't folded.
          !I->isEHPad() &&              // EH pad instructions aren't folded.
-         !FuncInfo->isExportedInst(I); // Exported instrs must be computed.
+         !FuncInfo->isExportedInst(I) && // Exported instrs must be computed.
+         !isGCRelocate(I); // GCRelocate cannot be skipped.
 }
 
 /// Set up SwiftErrorVals by going through the function. If the function has


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60184.193443.patch
Type: text/x-patch
Size: 1431 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190403/bc2cb43e/attachment.bin>


More information about the llvm-commits mailing list