[clang] 39a1fcb - [RISCV] Remove the HasSideEffects property from riscv_vector.td
Craig Topper via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 18 21:41:06 PDT 2021
Author: Craig Topper
Date: 2021-10-18T21:35:13-07:00
New Revision: 39a1fcb9cf5930eb3931ed0f9b8ef2f50dae4aa5
URL: https://github.com/llvm/llvm-project/commit/39a1fcb9cf5930eb3931ed0f9b8ef2f50dae4aa5
DIFF: https://github.com/llvm/llvm-project/commit/39a1fcb9cf5930eb3931ed0f9b8ef2f50dae4aa5.diff
LOG: [RISCV] Remove the HasSideEffects property from riscv_vector.td
It was being used to control the nothrow attribute on the builtins. The
nothrow attribute is for C++ exceptions. Even if the vector builtins
have side effects in IR, that's different than the nothrow attribute.
Reviewed By: HsiangKai
Differential Revision: https://reviews.llvm.org/D112028
Added:
Modified:
clang/include/clang/Basic/riscv_vector.td
clang/utils/TableGen/RISCVVEmitter.cpp
Removed:
################################################################################
diff --git a/clang/include/clang/Basic/riscv_vector.td b/clang/include/clang/Basic/riscv_vector.td
index e4b7dfd56b6a..607f277ebb4e 100644
--- a/clang/include/clang/Basic/riscv_vector.td
+++ b/clang/include/clang/Basic/riscv_vector.td
@@ -191,9 +191,6 @@ class RVVBuiltin<string suffix, string prototype, string type_range,
// All masked operations support overloading api.
bit HasNoMaskedOverloaded = true;
- // Reads or writes "memory" or has other side-effects.
- bit HasSideEffects = false;
-
// This builtin is valid for the given Log2LMULs.
list<int> Log2LMUL = [0, 1, 2, 3, -1, -2, -3];
@@ -1475,7 +1472,6 @@ multiclass RVVPseudoVNCVTBuiltin<string IR, string MName, string type_range,
// 6.1. vsetvli/vsetvl instructions
let HasVL = false,
HasMask = false,
- HasSideEffects = true,
HasPolicy = false,
Log2LMUL = [0],
ManualCodegen = [{IntrinsicTypes = {ResultType};}] in // Set XLEN type
diff --git a/clang/utils/TableGen/RISCVVEmitter.cpp b/clang/utils/TableGen/RISCVVEmitter.cpp
index 70921c221ae5..2815673aa4e1 100644
--- a/clang/utils/TableGen/RISCVVEmitter.cpp
+++ b/clang/utils/TableGen/RISCVVEmitter.cpp
@@ -153,7 +153,6 @@ class RVVIntrinsic {
std::string Name; // Builtin name
std::string MangledName;
std::string IRName;
- bool HasSideEffects;
bool IsMask;
bool HasVL;
bool HasPolicy;
@@ -170,9 +169,9 @@ class RVVIntrinsic {
public:
RVVIntrinsic(StringRef Name, StringRef Suffix, StringRef MangledName,
- StringRef MangledSuffix, StringRef IRName, bool HasSideEffects,
- bool IsMask, bool HasMaskedOffOperand, bool HasVL,
- bool HasPolicy, bool HasNoMaskedOverloaded, bool HasAutoDef,
+ StringRef MangledSuffix, StringRef IRName, bool IsMask,
+ bool HasMaskedOffOperand, bool HasVL, bool HasPolicy,
+ bool HasNoMaskedOverloaded, bool HasAutoDef,
StringRef ManualCodegen, const RVVTypes &Types,
const std::vector<int64_t> &IntrinsicTypes,
StringRef RequiredExtension, unsigned NF);
@@ -180,7 +179,6 @@ class RVVIntrinsic {
StringRef getName() const { return Name; }
StringRef getMangledName() const { return MangledName; }
- bool hasSideEffects() const { return HasSideEffects; }
bool hasVL() const { return HasVL; }
bool hasPolicy() const { return HasPolicy; }
bool hasNoMaskedOverloaded() const { return HasNoMaskedOverloaded; }
@@ -757,14 +755,13 @@ void RVVType::applyModifier(StringRef Transformer) {
//===----------------------------------------------------------------------===//
RVVIntrinsic::RVVIntrinsic(StringRef NewName, StringRef Suffix,
StringRef NewMangledName, StringRef MangledSuffix,
- StringRef IRName, bool HasSideEffects, bool IsMask,
+ StringRef IRName, bool IsMask,
bool HasMaskedOffOperand, bool HasVL, bool HasPolicy,
bool HasNoMaskedOverloaded, bool HasAutoDef,
StringRef ManualCodegen, const RVVTypes &OutInTypes,
const std::vector<int64_t> &NewIntrinsicTypes,
StringRef RequiredExtension, unsigned NF)
- : IRName(IRName), HasSideEffects(HasSideEffects), IsMask(IsMask),
- HasVL(HasVL), HasPolicy(HasPolicy),
+ : IRName(IRName), IsMask(IsMask), HasVL(HasVL), HasPolicy(HasPolicy),
HasNoMaskedOverloaded(HasNoMaskedOverloaded), HasAutoDef(HasAutoDef),
ManualCodegen(ManualCodegen.str()), NF(NF) {
@@ -1018,11 +1015,7 @@ void RVVEmitter::createBuiltins(raw_ostream &OS) {
OS << "#endif\n";
for (auto &Def : Defs) {
OS << "RISCVV_BUILTIN(__builtin_rvv_" << Def->getName() << ",\""
- << Def->getBuiltinTypeStr() << "\", ";
- if (!Def->hasSideEffects())
- OS << "\"n\")\n";
- else
- OS << "\"\")\n";
+ << Def->getBuiltinTypeStr() << "\", \"n\")\n";
}
OS << "#undef RISCVV_BUILTIN\n";
}
@@ -1093,7 +1086,6 @@ void RVVEmitter::createRVVIntrinsics(
bool HasVL = R->getValueAsBit("HasVL");
bool HasPolicy = R->getValueAsBit("HasPolicy");
bool HasNoMaskedOverloaded = R->getValueAsBit("HasNoMaskedOverloaded");
- bool HasSideEffects = R->getValueAsBit("HasSideEffects");
std::vector<int64_t> Log2LMULList = R->getValueAsListOfInts("Log2LMUL");
StringRef ManualCodegen = R->getValueAsString("ManualCodegen");
StringRef ManualCodegenMask = R->getValueAsString("ManualCodegenMask");
@@ -1165,17 +1157,17 @@ void RVVEmitter::createRVVIntrinsics(
// Create a non-mask intrinsic
Out.push_back(std::make_unique<RVVIntrinsic>(
Name, SuffixStr, MangledName, MangledSuffixStr, IRName,
- HasSideEffects, /*IsMask=*/false, /*HasMaskedOffOperand=*/false,
- HasVL, HasPolicy, HasNoMaskedOverloaded, HasAutoDef, ManualCodegen,
- Types.getValue(), IntrinsicTypes, RequiredExtension, NF));
+ /*IsMask=*/false, /*HasMaskedOffOperand=*/false, HasVL, HasPolicy,
+ HasNoMaskedOverloaded, HasAutoDef, ManualCodegen, Types.getValue(),
+ IntrinsicTypes, RequiredExtension, NF));
if (HasMask) {
// Create a mask intrinsic
Optional<RVVTypes> MaskTypes =
computeTypes(I, Log2LMUL, NF, ProtoMaskSeq);
Out.push_back(std::make_unique<RVVIntrinsic>(
Name, SuffixStr, MangledName, MangledSuffixStr, IRNameMask,
- HasSideEffects, /*IsMask=*/true, HasMaskedOffOperand, HasVL,
- HasPolicy, HasNoMaskedOverloaded, HasAutoDef, ManualCodegenMask,
+ /*IsMask=*/true, HasMaskedOffOperand, HasVL, HasPolicy,
+ HasNoMaskedOverloaded, HasAutoDef, ManualCodegenMask,
MaskTypes.getValue(), IntrinsicTypes, RequiredExtension, NF));
}
} // end for Log2LMULList
More information about the cfe-commits
mailing list