[Attributor][modulemap] Revert r368064 but fix the build
Commit r368064 was necessary after r367953 (D65712) broke the module
build. That happened, apparently, because the template class IRAttribute
defined in the header had a virtual method defined in the corresponding
source file (IRAttribute::manifest). To unbreak the situation this patch
introduces a helper function IRAttributeManifest::manifestAttrs which
is used to implement IRAttribute::manifest in the header. The deifnition
of the helper function is still in the source file.
Patch by jdoerfert (Johannes Doerfert)
Differential Revision: https://reviews.llvm.org/D65821
llvm-svn: 368076
diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp
index 22c6d4f..d98028a 100644
--- a/llvm/lib/Transforms/IPO/Attributor.cpp
+++ b/llvm/lib/Transforms/IPO/Attributor.cpp
@@ -332,21 +332,16 @@
return HasChanged;
}
-template <Attribute::AttrKind AK, typename Base>
-ChangeStatus IRAttribute<AK, Base>::manifest(Attributor &A) {
- assert(this->getState().isValidState() &&
- "Attempted to manifest an invalid state!");
- assert(getIRPosition().getAssociatedValue() &&
+ ChangeStatus IRAttributeManifest::manifestAttrs(Attributor &A, IRPosition
+ &IRP, const ArrayRef<Attribute> &DeducedAttrs) {
+ assert(IRP.getAssociatedValue() &&
"Attempted to manifest an attribute without associated value!");
ChangeStatus HasChanged = ChangeStatus::UNCHANGED;
- Function &ScopeFn = getAnchorScope();
+ Function &ScopeFn = IRP.getAnchorScope();
LLVMContext &Ctx = ScopeFn.getContext();
- IRPosition::Kind PK = getPositionKind();
-
- SmallVector<Attribute, 4> DeducedAttrs;
- getDeducedAttributes(Ctx, DeducedAttrs);
+ IRPosition::Kind PK = IRP.getPositionKind();
// In the following some generic code that will manifest attributes in
// DeducedAttrs if they improve the current IR. Due to the different
@@ -360,12 +355,12 @@
Attrs = ScopeFn.getAttributes();
break;
case IRPosition::IRP_CALL_SITE_ARGUMENT:
- Attrs = ImmutableCallSite(&getAnchorValue()).getAttributes();
+ Attrs = ImmutableCallSite(&IRP.getAnchorValue()).getAttributes();
break;
}
for (const Attribute &Attr : DeducedAttrs) {
- if (!addIfNotExistent(Ctx, Attr, Attrs, getAttrIdx()))
+ if (!addIfNotExistent(Ctx, Attr, Attrs, IRP.getAttrIdx()))
continue;
HasChanged = ChangeStatus::CHANGED;
@@ -382,7 +377,7 @@
ScopeFn.setAttributes(Attrs);
break;
case IRPosition::IRP_CALL_SITE_ARGUMENT:
- CallSite(&getAnchorValue()).setAttributes(Attrs);
+ CallSite(&IRP.getAnchorValue()).setAttributes(Attrs);
}
return HasChanged;