[llvm] 37a2c45 - [NFC][OpaquePtr] Make getMemoryParamAllocType() compatible with opaque pointers
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 11 16:01:44 PDT 2021
Author: Arthur Eubanks
Date: 2021-06-11T16:01:23-07:00
New Revision: 37a2c4517bbf93bca18f9c67d9c6cfb3a6a627ec
URL: https://github.com/llvm/llvm-project/commit/37a2c4517bbf93bca18f9c67d9c6cfb3a6a627ec
DIFF: https://github.com/llvm/llvm-project/commit/37a2c4517bbf93bca18f9c67d9c6cfb3a6a627ec.diff
LOG: [NFC][OpaquePtr] Make getMemoryParamAllocType() compatible with opaque pointers
These ABI attributes now always require the type parameter.
sret was missing from the first set of checks but was covered by the
second set.
Added:
Modified:
llvm/lib/IR/Function.cpp
Removed:
################################################################################
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp
index 29e0c64c4ea2..25c59d03c7b9 100644
--- a/llvm/lib/IR/Function.cpp
+++ b/llvm/lib/IR/Function.cpp
@@ -169,14 +169,8 @@ static Type *getMemoryParamAllocType(AttributeSet ParamAttrs, Type *ArgTy) {
return PreAllocTy;
if (Type *InAllocaTy = ParamAttrs.getInAllocaType())
return InAllocaTy;
-
- // FIXME: sret and inalloca always depends on pointee element type. It's also
- // possible for byval to miss it.
- if (ParamAttrs.hasAttribute(Attribute::InAlloca) ||
- ParamAttrs.hasAttribute(Attribute::ByVal) ||
- ParamAttrs.hasAttribute(Attribute::StructRet) ||
- ParamAttrs.hasAttribute(Attribute::Preallocated))
- return cast<PointerType>(ArgTy)->getElementType();
+ if (Type *SRetTy = ParamAttrs.getStructRetType())
+ return SRetTy;
return nullptr;
}
More information about the llvm-commits
mailing list