[llvm] f62a400 - [Statepoint] Determine return type from elementtype attribute

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 4 05:40:37 PST 2022


Author: Nikita Popov
Date: 2022-02-04T14:40:27+01:00
New Revision: f62a400cdf114ff97fee99d74234c889142a34e7

URL: https://github.com/llvm/llvm-project/commit/f62a400cdf114ff97fee99d74234c889142a34e7
DIFF: https://github.com/llvm/llvm-project/commit/f62a400cdf114ff97fee99d74234c889142a34e7.diff

LOG: [Statepoint] Determine return type from elementtype attribute

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.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/IR/Statepoint.h b/llvm/include/llvm/IR/Statepoint.h
index da9c732ad818f..8e997d97024cb 100644
--- a/llvm/include/llvm/IR/Statepoint.h
+++ b/llvm/include/llvm/IR/Statepoint.h
@@ -121,9 +121,9 @@ class GCStatepointInst : public CallBase {
   /// 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();
   }
 
 

diff  --git a/llvm/test/CodeGen/X86/statepoint-call-lowering.ll b/llvm/test/CodeGen/X86/statepoint-call-lowering.ll
index 77421e66201c4..b4a590ad63f65 100644
--- a/llvm/test/CodeGen/X86/statepoint-call-lowering.ll
+++ b/llvm/test/CodeGen/X86/statepoint-call-lowering.ll
@@ -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.
 


        


More information about the llvm-commits mailing list