[Statepoint] Determine return type from elementtype attribute
authorNikita Popov <npopov@redhat.com>
Fri, 4 Feb 2022 13:37:02 +0000 (14:37 +0100)
committerNikita Popov <npopov@redhat.com>
Fri, 4 Feb 2022 13:40:27 +0000 (14:40 +0100)
Based on the LangRef change in D117890, this uses the elementtype
attribute rather than the pointer element type to determine the
statepoint callee function type, making statepoints compatible
with opaque pointers.

llvm/include/llvm/IR/Statepoint.h
llvm/test/CodeGen/X86/statepoint-call-lowering.ll

index da9c732..8e997d9 100644 (file)
@@ -121,9 +121,9 @@ public:
   /// Return the type of the value returned by the call underlying the
   /// statepoint.
   Type *getActualReturnType() const {
-    auto *CalleeTy =
-        getActualCalledOperand()->getType()->getPointerElementType();
-    return cast<FunctionType>(CalleeTy)->getReturnType();
+    auto *FT = cast<FunctionType>(
+        getAttributes().getParamElementType(CalledFunctionPos));
+    return FT->getReturnType();
   }
 
 
index 77421e6..b4a590a 100644 (file)
@@ -1,5 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc -verify-machineinstrs < %s | FileCheck %s
+; RUN: llc -verify-machineinstrs -opaque-pointers < %s | FileCheck %s
 ; This file contains a collection of basic tests to ensure we didn't
 ; screw up normal call lowering when there are no deopt or gc arguments.