[llvm] 4318d3c - [Attributor] Automatically deal with undef values for IRAttributes
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 30 18:42:47 PDT 2019
Author: Johannes Doerfert
Date: 2019-10-30T20:41:36-05:00
New Revision: 4318d3c64ccd0e172c1ac108ff8d646330bfd4b3
URL: https://github.com/llvm/llvm-project/commit/4318d3c64ccd0e172c1ac108ff8d646330bfd4b3
DIFF: https://github.com/llvm/llvm-project/commit/4318d3c64ccd0e172c1ac108ff8d646330bfd4b3.diff
LOG: [Attributor] Automatically deal with undef values for IRAttributes
For (almost) all IRAttribute we can derive whatever we want for undef
values so it makes sense to provide this functionality in the base
class. At the same time, we probably do not want to annotate them.
Added:
Modified:
llvm/include/llvm/Transforms/IPO/Attributor.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/Transforms/IPO/Attributor.h b/llvm/include/llvm/Transforms/IPO/Attributor.h
index 2451ae1a2d29..cb7a4b0123f0 100644
--- a/llvm/include/llvm/Transforms/IPO/Attributor.h
+++ b/llvm/include/llvm/Transforms/IPO/Attributor.h
@@ -1345,12 +1345,12 @@ struct IRAttribute : public IRPosition, public Base {
/// See AbstractAttribute::initialize(...).
virtual void initialize(Attributor &A) override {
- if (hasAttr(getAttrKind())) {
+ const IRPosition &IRP = this->getIRPosition();
+ if (isa<UndefValue>(IRP.getAssociatedValue()) || hasAttr(getAttrKind())) {
this->getState().indicateOptimisticFixpoint();
return;
}
- const IRPosition &IRP = this->getIRPosition();
bool IsFnInterface = IRP.isFnInterfaceKind();
const Function *FnScope = IRP.getAnchorScope();
// TODO: Not all attributes require an exact definition. Find a way to
@@ -1366,6 +1366,8 @@ struct IRAttribute : public IRPosition, public Base {
/// See AbstractAttribute::manifest(...).
ChangeStatus manifest(Attributor &A) override {
+ if (isa<UndefValue>(getIRPosition().getAssociatedValue()))
+ return ChangeStatus::UNCHANGED;
SmallVector<Attribute, 4> DeducedAttrs;
getDeducedAttributes(getAnchorValue().getContext(), DeducedAttrs);
return IRAttributeManifest::manifestAttrs(A, getIRPosition(), DeducedAttrs);
More information about the llvm-commits
mailing list