[Statepoints] Take result type from gc.result [NFC]
authorPhilip Reames <listmail@philipreames.com>
Mon, 31 Jan 2022 17:42:34 +0000 (09:42 -0800)
committerPhilip Reames <listmail@philipreames.com>
Mon, 31 Jan 2022 17:42:34 +0000 (09:42 -0800)
When lowering a gc.result, we can assume that the result type of the gc.result matches the type of the underlying call.  This is explicitly required in LangRef.

At the moment, this makes little difference, but for opaque pointers we need a means to get result typing without relying on pointee types.

llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp

index 2e8769e..955efed 100644 (file)
@@ -1180,7 +1180,7 @@ void SelectionDAGBuilder::visitGCResult(const GCResultInst &CI) {
   // register because statepoint and actual call return types can be
   // different, and getValue() will use CopyFromReg of the wrong type,
   // which is always i32 in our case.
-  Type *RetTy = SI->getActualReturnType();
+  Type *RetTy = CI.getType();
   SDValue CopyFromReg = getCopyFromRegs(SI, RetTy);
   
   assert(CopyFromReg.getNode());