diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -1721,7 +1721,8 @@ // to keep track of gc-relocates for a particular gc-statepoint. This is // done by SelectionDAGBuilder::LowerAsSTATEPOINT, called before // visitGCRelocate. - if (isa(Inst) && !isStatepoint(Inst) && !isGCRelocate(Inst)) { + if (isa(Inst) && !isStatepoint(Inst) && !isGCRelocate(Inst) && + !isGCResult(Inst)) { OptimizationRemarkMissed R("sdagisel", "FastISelFailure", Inst->getDebugLoc(), LLVMBB); diff --git a/llvm/test/CodeGen/X86/fast-isel-gc-intrinsics.ll b/llvm/test/CodeGen/X86/fast-isel-gc-intrinsics.ll --- a/llvm/test/CodeGen/X86/fast-isel-gc-intrinsics.ll +++ b/llvm/test/CodeGen/X86/fast-isel-gc-intrinsics.ll @@ -17,6 +17,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) %call1 = call zeroext i1 @llvm.experimental.gc.result.i1(token %safepoint_token) + br label %exit +exit: ret i1 %call1 }