summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp3
-rw-r--r--llvm/lib/Bitcode/Writer/ValueEnumerator.cpp2
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp3
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp4
-rw-r--r--llvm/lib/IR/Function.cpp4
5 files changed, 11 insertions, 5 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 9f562ba82db..c33fc568abe 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -3049,7 +3049,8 @@ Error BitcodeReader::parseFunctionRecord(ArrayRef<uint64_t> Record) {
// pointee type. There should be no opaque pointers where the byval type is
// implicit.
for (auto &Arg : Func->args()) {
- if (Arg.hasByValAttr() && !Arg.getParamByValType()) {
+ if (Arg.hasByValAttr() &&
+ !Arg.getAttribute(Attribute::ByVal).getValueAsType()) {
Arg.removeAttr(Attribute::ByVal);
Arg.addAttr(Attribute::getWithByValType(
Context, Arg.getType()->getPointerElementType()));
diff --git a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
index 143570fb20a..f59c906c7b7 100644
--- a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
+++ b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
@@ -951,7 +951,7 @@ void ValueEnumerator::incorporateFunction(const Function &F) {
// Adding function arguments to the value table.
for (const auto &I : F.args()) {
EnumerateValue(&I);
- if (I.hasAttribute(Attribute::ByVal) && I.getParamByValType())
+ if (I.hasAttribute(Attribute::ByVal))
EnumerateType(I.getParamByValType());
}
FirstFuncConstantID = Values.size();
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 4f7257d4a15..07d6ac83e03 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -9584,8 +9584,7 @@ void SelectionDAGISel::LowerArguments(const Function &F) {
// For ByVal, size and alignment should be passed from FE. BE will
// guess if this info is not there but there are cases it cannot get
// right.
- unsigned FrameSize = DL.getTypeAllocSize(
- Arg.getParamByValType() ? Arg.getParamByValType() : ElementTy);
+ unsigned FrameSize = DL.getTypeAllocSize(Arg.getParamByValType());
Flags.setByValSize(FrameSize);
unsigned FrameAlign;
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index 6e6917b39b6..c2123dbfdd9 100644
--- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -112,7 +112,9 @@ void TargetLoweringBase::ArgListEntry::setAttributes(const CallBase *Call,
IsSwiftSelf = Call->paramHasAttr(ArgIdx, Attribute::SwiftSelf);
IsSwiftError = Call->paramHasAttr(ArgIdx, Attribute::SwiftError);
Alignment = Call->getParamAlignment(ArgIdx);
- ByValType = Call->getParamByValType(ArgIdx);
+ ByValType = nullptr;
+ if (Call->paramHasAttr(ArgIdx, Attribute::ByVal))
+ ByValType = Call->getParamByValType(ArgIdx);
}
/// Generate a libcall taking the given operands as arguments and returning a
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp
index a4a78ca4deb..c88fd1a82cd 100644
--- a/llvm/lib/IR/Function.cpp
+++ b/llvm/lib/IR/Function.cpp
@@ -194,6 +194,10 @@ bool Argument::hasAttribute(Attribute::AttrKind Kind) const {
return getParent()->hasParamAttribute(getArgNo(), Kind);
}
+Attribute Argument::getAttribute(Attribute::AttrKind Kind) const {
+ return getParent()->getParamAttribute(getArgNo(), Kind);
+}
+
//===----------------------------------------------------------------------===//
// Helper Methods in Function
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud