[llvm] 2f38c75 - Revert "[IR] Intrinsics default attributes and opt-out flag"
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 19 22:28:41 PDT 2020
Author: Johannes Doerfert
Date: 2020-08-20T00:25:32-05:00
New Revision: 2f38c755ba46d1357d79c922966d964694eb854e
URL: https://github.com/llvm/llvm-project/commit/2f38c755ba46d1357d79c922966d964694eb854e
DIFF: https://github.com/llvm/llvm-project/commit/2f38c755ba46d1357d79c922966d964694eb854e.diff
LOG: Revert "[IR] Intrinsics default attributes and opt-out flag"
This commit introduced a non-trivial compile time regression that needs
to be addressed: https://reviews.llvm.org/D70365#2227627
Given that it is unclear how long that will take, I'll revert it for
now.
This reverts commit eedf18fc1f5fc71bb896204abf41fc5a2dbf25f7.
Added:
Modified:
llvm/include/llvm/IR/Intrinsics.td
llvm/test/TableGen/intrin-side-effects.td
llvm/test/TableGen/intrinsic-long-name.td
llvm/test/TableGen/intrinsic-pointer-to-any.td
llvm/test/TableGen/intrinsic-struct.td
llvm/test/TableGen/intrinsic-varargs.td
llvm/test/TableGen/searchabletables-intrinsic.td
llvm/utils/TableGen/CodeGenIntrinsics.h
llvm/utils/TableGen/CodeGenTarget.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/IR/Intrinsics.td b/llvm/include/llvm/IR/Intrinsics.td
index 8ece1f8b1b12..3162d4bea529 100644
--- a/llvm/include/llvm/IR/Intrinsics.td
+++ b/llvm/include/llvm/IR/Intrinsics.td
@@ -17,9 +17,7 @@ include "llvm/CodeGen/SDNodeProperties.td"
// Properties we keep track of for intrinsics.
//===----------------------------------------------------------------------===//
-class IntrinsicProperty<bit is_default = 0> {
- bit IsDefault = is_default;
-}
+class IntrinsicProperty;
// Intr*Mem - Memory properties. If no property is set, the worst case
// is assumed (it may read and write any memory it can get access to and it may
@@ -333,8 +331,7 @@ class Intrinsic<list<LLVMType> ret_types,
list<LLVMType> param_types = [],
list<IntrinsicProperty> intr_properties = [],
string name = "",
- list<SDNodeProperty> sd_properties = [],
- bit disable_default_attributes = 0> : SDPatternOperator {
+ list<SDNodeProperty> sd_properties = []> : SDPatternOperator {
string LLVMName = name;
string TargetPrefix = ""; // Set to a prefix for target-specific intrinsics.
list<LLVMType> RetTypes = ret_types;
@@ -342,10 +339,6 @@ class Intrinsic<list<LLVMType> ret_types,
list<IntrinsicProperty> IntrProperties = intr_properties;
let Properties = sd_properties;
- // Disable applying IntrinsicProperties that are marked default with
- // IntrinsicProperty<1>
- bit DisableDefaultAttributes = disable_default_attributes;
-
bit isTarget = 0;
}
diff --git a/llvm/test/TableGen/intrin-side-effects.td b/llvm/test/TableGen/intrin-side-effects.td
index f58d37453282..7588855830fa 100644
--- a/llvm/test/TableGen/intrin-side-effects.td
+++ b/llvm/test/TableGen/intrin-side-effects.td
@@ -11,10 +11,7 @@ class LLVMType<ValueType vt> {
def llvm_i32_ty : LLVMType<i32>;
-class IntrinsicProperty<bit is_default = 0> {
- bit IsDefault = is_default;
-}
-
+class IntrinsicProperty;
def IntrNoMem : IntrinsicProperty;
def IntrHasSideEffects : IntrinsicProperty;
@@ -30,8 +27,6 @@ class Intrinsic<list<LLVMType> ret_types,
list<LLVMType> ParamTypes = param_types;
list<IntrinsicProperty> IntrProperties = intr_properties;
let Properties = sd_properties;
- bit DisableDefaultAttributes = 1;
-
bit isTarget = 0;
}
diff --git a/llvm/test/TableGen/intrinsic-long-name.td b/llvm/test/TableGen/intrinsic-long-name.td
index d66173202302..c2f696e8ca18 100644
--- a/llvm/test/TableGen/intrinsic-long-name.td
+++ b/llvm/test/TableGen/intrinsic-long-name.td
@@ -1,10 +1,7 @@
// RUN: llvm-tblgen -gen-intrinsic-enums %s | FileCheck %s
// XFAIL: vg_leak
-class IntrinsicProperty<bit is_default = 0> {
- bit IsDefault = is_default;
-}
-
+class IntrinsicProperty;
class SDNodeProperty;
class ValueType<int size, int value> {
@@ -25,7 +22,6 @@ class Intrinsic<string name, list<LLVMType> param_types = []> {
list<LLVMType> ParamTypes = param_types;
list<IntrinsicProperty> IntrProperties = [];
list<SDNodeProperty> Properties = [];
- bit DisableDefaultAttributes = 1;
}
def iAny : ValueType<0, 253>;
diff --git a/llvm/test/TableGen/intrinsic-pointer-to-any.td b/llvm/test/TableGen/intrinsic-pointer-to-any.td
index 0b0bc1510775..c58595acfde7 100644
--- a/llvm/test/TableGen/intrinsic-pointer-to-any.td
+++ b/llvm/test/TableGen/intrinsic-pointer-to-any.td
@@ -6,10 +6,7 @@
// case, so TableGen would hit an assertion in EncodeFixedType that was checking
// to ensure that the substitution being processed was correctly replaced.
-class IntrinsicProperty<bit is_default = 0> {
- bit IsDefault = is_default;
-}
-
+class IntrinsicProperty;
class SDNodeProperty;
class ValueType<int size, int value> {
@@ -35,7 +32,6 @@ class Intrinsic<list<LLVMType> ret_types> {
list<IntrinsicProperty> IntrProperties = [];
list<SDNodeProperty> Properties = [];
bit isTarget = 0;
- bit DisableDefaultAttributes = 1;
}
class LLVMQualPointerType<LLVMType elty>
diff --git a/llvm/test/TableGen/intrinsic-struct.td b/llvm/test/TableGen/intrinsic-struct.td
index bc044a4a6f85..7a3089c802a9 100644
--- a/llvm/test/TableGen/intrinsic-struct.td
+++ b/llvm/test/TableGen/intrinsic-struct.td
@@ -1,10 +1,7 @@
// RUN: llvm-tblgen -gen-intrinsic-enums %s | FileCheck %s
// XFAIL: vg_leak
-class IntrinsicProperty<bit is_default = 0> {
- bit IsDefault = is_default;
-}
-
+class IntrinsicProperty;
class SDNodeProperty;
class ValueType<int size, int value> {
@@ -25,7 +22,6 @@ class Intrinsic<string name, list<LLVMType> ret_types = []> {
list<LLVMType> ParamTypes = [];
list<IntrinsicProperty> IntrProperties = [];
list<SDNodeProperty> Properties = [];
- bit DisableDefaultAttributes = 1;
}
def iAny : ValueType<0, 253>;
diff --git a/llvm/test/TableGen/intrinsic-varargs.td b/llvm/test/TableGen/intrinsic-varargs.td
index da860ed0129c..6a2252215a83 100644
--- a/llvm/test/TableGen/intrinsic-varargs.td
+++ b/llvm/test/TableGen/intrinsic-varargs.td
@@ -3,9 +3,7 @@
include "llvm/CodeGen/ValueTypes.td"
-class IntrinsicProperty<bit is_default = 0> {
- bit IsDefault = is_default;
-}
+class IntrinsicProperty;
class SDNodeProperty;
class LLVMType<ValueType vt> {
@@ -20,7 +18,6 @@ class Intrinsic<string name, list<LLVMType> param_types = []> {
list<LLVMType> ParamTypes = param_types;
list<IntrinsicProperty> IntrProperties = [];
list<SDNodeProperty> Properties = [];
- bit DisableDefaultAttributes = 1;
}
def llvm_vararg_ty : LLVMType<isVoid>; // this means vararg here
diff --git a/llvm/test/TableGen/searchabletables-intrinsic.td b/llvm/test/TableGen/searchabletables-intrinsic.td
index 75722d19b16e..e5cb9db3aa6b 100644
--- a/llvm/test/TableGen/searchabletables-intrinsic.td
+++ b/llvm/test/TableGen/searchabletables-intrinsic.td
@@ -3,10 +3,7 @@
include "llvm/TableGen/SearchableTable.td"
-class IntrinsicProperty<bit is_default = 0> {
- bit IsDefault = is_default;
-}
-
+class IntrinsicProperty;
class SDNodeProperty;
class ValueType<int size, int value> {
@@ -27,7 +24,6 @@ class Intrinsic<list<LLVMType> param_types = []> {
list<LLVMType> ParamTypes = param_types;
list<IntrinsicProperty> IntrProperties = [];
list<SDNodeProperty> Properties = [];
- bit DisableDefaultAttributes = 1;
}
def iAny : ValueType<0, 253>;
diff --git a/llvm/utils/TableGen/CodeGenIntrinsics.h b/llvm/utils/TableGen/CodeGenIntrinsics.h
index 097c677c35b4..af59c1f3d833 100644
--- a/llvm/utils/TableGen/CodeGenIntrinsics.h
+++ b/llvm/utils/TableGen/CodeGenIntrinsics.h
@@ -176,13 +176,6 @@ struct CodeGenIntrinsic {
return Properties & (1 << Prop);
}
- /// Goes through all IntrProperties and sets to true ones that have IsDefault
- /// value set to true.
- void setDefaultProperties(Record *R);
-
- /// Helper function to set property \p Name to true;
- void setProperty(Record *R);
-
/// Returns true if the parameter at \p ParamIdx is a pointer type. Returns
/// false if the parameter is not a pointer, or \p ParamIdx is greater than
/// the size of \p IS.ParamVTs.
diff --git a/llvm/utils/TableGen/CodeGenTarget.cpp b/llvm/utils/TableGen/CodeGenTarget.cpp
index 7806c91c5a93..891a08ea590e 100644
--- a/llvm/utils/TableGen/CodeGenTarget.cpp
+++ b/llvm/utils/TableGen/CodeGenTarget.cpp
@@ -766,9 +766,6 @@ CodeGenIntrinsic::CodeGenIntrinsic(Record *R) {
IS.ParamTypeDefs.push_back(TyEl);
}
- // Set default properties to true.
- setDefaultProperties(R);
-
// Parse the intrinsic properties.
ListInit *PropList = R->getValueAsListInit("IntrProperties");
for (unsigned i = 0, e = PropList->size(); i != e; ++i) {
@@ -776,7 +773,68 @@ CodeGenIntrinsic::CodeGenIntrinsic(Record *R) {
assert(Property->isSubClassOf("IntrinsicProperty") &&
"Expected a property!");
- setProperty(Property);
+ if (Property->getName() == "IntrNoMem")
+ ModRef = NoMem;
+ else if (Property->getName() == "IntrReadMem")
+ ModRef = ModRefBehavior(ModRef & ~MR_Mod);
+ else if (Property->getName() == "IntrWriteMem")
+ ModRef = ModRefBehavior(ModRef & ~MR_Ref);
+ else if (Property->getName() == "IntrArgMemOnly")
+ ModRef = ModRefBehavior((ModRef & ~MR_Anywhere) | MR_ArgMem);
+ else if (Property->getName() == "IntrInaccessibleMemOnly")
+ ModRef = ModRefBehavior((ModRef & ~MR_Anywhere) | MR_InaccessibleMem);
+ else if (Property->getName() == "IntrInaccessibleMemOrArgMemOnly")
+ ModRef = ModRefBehavior((ModRef & ~MR_Anywhere) | MR_ArgMem |
+ MR_InaccessibleMem);
+ else if (Property->getName() == "Commutative")
+ isCommutative = true;
+ else if (Property->getName() == "Throws")
+ canThrow = true;
+ else if (Property->getName() == "IntrNoDuplicate")
+ isNoDuplicate = true;
+ else if (Property->getName() == "IntrConvergent")
+ isConvergent = true;
+ else if (Property->getName() == "IntrNoReturn")
+ isNoReturn = true;
+ else if (Property->getName() == "IntrNoSync")
+ isNoSync = true;
+ else if (Property->getName() == "IntrNoFree")
+ isNoFree = true;
+ else if (Property->getName() == "IntrWillReturn")
+ isWillReturn = true;
+ else if (Property->getName() == "IntrCold")
+ isCold = true;
+ else if (Property->getName() == "IntrSpeculatable")
+ isSpeculatable = true;
+ else if (Property->getName() == "IntrHasSideEffects")
+ hasSideEffects = true;
+ else if (Property->isSubClassOf("NoCapture")) {
+ unsigned ArgNo = Property->getValueAsInt("ArgNo");
+ ArgumentAttributes.emplace_back(ArgNo, NoCapture, 0);
+ } else if (Property->isSubClassOf("NoAlias")) {
+ unsigned ArgNo = Property->getValueAsInt("ArgNo");
+ ArgumentAttributes.emplace_back(ArgNo, NoAlias, 0);
+ } else if (Property->isSubClassOf("Returned")) {
+ unsigned ArgNo = Property->getValueAsInt("ArgNo");
+ ArgumentAttributes.emplace_back(ArgNo, Returned, 0);
+ } else if (Property->isSubClassOf("ReadOnly")) {
+ unsigned ArgNo = Property->getValueAsInt("ArgNo");
+ ArgumentAttributes.emplace_back(ArgNo, ReadOnly, 0);
+ } else if (Property->isSubClassOf("WriteOnly")) {
+ unsigned ArgNo = Property->getValueAsInt("ArgNo");
+ ArgumentAttributes.emplace_back(ArgNo, WriteOnly, 0);
+ } else if (Property->isSubClassOf("ReadNone")) {
+ unsigned ArgNo = Property->getValueAsInt("ArgNo");
+ ArgumentAttributes.emplace_back(ArgNo, ReadNone, 0);
+ } else if (Property->isSubClassOf("ImmArg")) {
+ unsigned ArgNo = Property->getValueAsInt("ArgNo");
+ ArgumentAttributes.emplace_back(ArgNo, ImmArg, 0);
+ } else if (Property->isSubClassOf("Align")) {
+ unsigned ArgNo = Property->getValueAsInt("ArgNo");
+ uint64_t Align = Property->getValueAsInt("Align");
+ ArgumentAttributes.emplace_back(ArgNo, Alignment, Align);
+ } else
+ llvm_unreachable("Unknown property!");
}
// Also record the SDPatternOperator Properties.
@@ -786,84 +844,6 @@ CodeGenIntrinsic::CodeGenIntrinsic(Record *R) {
llvm::sort(ArgumentAttributes);
}
-void CodeGenIntrinsic::setDefaultProperties(Record *R) {
- // opt-out of using default attributes.
- if (R->getValueAsBit("DisableDefaultAttributes"))
- return;
-
- std::vector<Record *> Defs =
- R->getRecords().getAllDerivedDefinitions("IntrinsicProperty");
-
- for (Record *Rec : Defs)
- if (Rec->getValueAsBit("IsDefault"))
- setProperty(Rec);
-}
-
-void CodeGenIntrinsic::setProperty(Record *R) {
- if (R->getName() == "IntrNoMem")
- ModRef = NoMem;
- else if (R->getName() == "IntrReadMem")
- ModRef = ModRefBehavior(ModRef & ~MR_Mod);
- else if (R->getName() == "IntrWriteMem")
- ModRef = ModRefBehavior(ModRef & ~MR_Ref);
- else if (R->getName() == "IntrArgMemOnly")
- ModRef = ModRefBehavior((ModRef & ~MR_Anywhere) | MR_ArgMem);
- else if (R->getName() == "IntrInaccessibleMemOnly")
- ModRef = ModRefBehavior((ModRef & ~MR_Anywhere) | MR_InaccessibleMem);
- else if (R->getName() == "IntrInaccessibleMemOrArgMemOnly")
- ModRef = ModRefBehavior((ModRef & ~MR_Anywhere) | MR_ArgMem |
- MR_InaccessibleMem);
- else if (R->getName() == "Commutative")
- isCommutative = true;
- else if (R->getName() == "Throws")
- canThrow = true;
- else if (R->getName() == "IntrNoDuplicate")
- isNoDuplicate = true;
- else if (R->getName() == "IntrConvergent")
- isConvergent = true;
- else if (R->getName() == "IntrNoReturn")
- isNoReturn = true;
- else if (R->getName() == "IntrNoSync")
- isNoSync = true;
- else if (R->getName() == "IntrNoFree")
- isNoFree = true;
- else if (R->getName() == "IntrWillReturn")
- isWillReturn = true;
- else if (R->getName() == "IntrCold")
- isCold = true;
- else if (R->getName() == "IntrSpeculatable")
- isSpeculatable = true;
- else if (R->getName() == "IntrHasSideEffects")
- hasSideEffects = true;
- else if (R->isSubClassOf("NoCapture")) {
- unsigned ArgNo = R->getValueAsInt("ArgNo");
- ArgumentAttributes.emplace_back(ArgNo, NoCapture, 0);
- } else if (R->isSubClassOf("NoAlias")) {
- unsigned ArgNo = R->getValueAsInt("ArgNo");
- ArgumentAttributes.emplace_back(ArgNo, NoAlias, 0);
- } else if (R->isSubClassOf("Returned")) {
- unsigned ArgNo = R->getValueAsInt("ArgNo");
- ArgumentAttributes.emplace_back(ArgNo, Returned, 0);
- } else if (R->isSubClassOf("ReadOnly")) {
- unsigned ArgNo = R->getValueAsInt("ArgNo");
- ArgumentAttributes.emplace_back(ArgNo, ReadOnly, 0);
- } else if (R->isSubClassOf("WriteOnly")) {
- unsigned ArgNo = R->getValueAsInt("ArgNo");
- ArgumentAttributes.emplace_back(ArgNo, WriteOnly, 0);
- } else if (R->isSubClassOf("ReadNone")) {
- unsigned ArgNo = R->getValueAsInt("ArgNo");
- ArgumentAttributes.emplace_back(ArgNo, ReadNone, 0);
- } else if (R->isSubClassOf("ImmArg")) {
- unsigned ArgNo = R->getValueAsInt("ArgNo");
- ArgumentAttributes.emplace_back(ArgNo, ImmArg, 0);
- } else if (R->isSubClassOf("Align")) {
- unsigned ArgNo = R->getValueAsInt("ArgNo");
- uint64_t Align = R->getValueAsInt("Align");
- ArgumentAttributes.emplace_back(ArgNo, Alignment, Align);
- } else
- llvm_unreachable("Unknown property!");
-}
-
bool CodeGenIntrinsic::isParamAPointer(unsigned ParamIdx) const {
if (ParamIdx >= IS.ParamVTs.size())
return false;
More information about the llvm-commits
mailing list