summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2019-06-14 13:42:40 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2019-06-14 13:42:40 +0000
commit731a81598edb5b5d8ab61c8fdab1fefaf808a888 (patch)
tree712cdf1a9b7159e908ded79b3315519b2b864420
parent5d0bebcdf252db130cc7a5b2e5e27acc9e8fcddc (diff)
downloadbcm5719-llvm-731a81598edb5b5d8ab61c8fdab1fefaf808a888.tar.gz
bcm5719-llvm-731a81598edb5b5d8ab61c8fdab1fefaf808a888.zip
RegBankSelect: Remove checks for invalid mappings
Avoid a check for valid and a set of redundant asserts. The place InstructionMapping is constructed asserts all of the default fields are passed anyway for an invalid mapping, so don't overcomplicate this. llvm-svn: 363391
-rw-r--r--llvm/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h6
-rw-r--r--llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp7
2 files changed, 3 insertions, 10 deletions
diff --git a/llvm/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h b/llvm/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h
index 37a63d1bae0..f6a58abf64c 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h
@@ -193,7 +193,7 @@ public:
unsigned Cost = 0;
/// Mapping of all the operands.
- const ValueMapping *OperandsMapping;
+ const ValueMapping *OperandsMapping = nullptr;
/// Number of operands.
unsigned NumOperands = 0;
@@ -210,15 +210,11 @@ public:
/// The rationale is that it is more efficient for the optimizers
/// to be able to assume that the mapping of the ith operand is
/// at the index i.
- ///
- /// \pre ID != InvalidMappingID
InstructionMapping(unsigned ID, unsigned Cost,
const ValueMapping *OperandsMapping,
unsigned NumOperands)
: ID(ID), Cost(Cost), OperandsMapping(OperandsMapping),
NumOperands(NumOperands) {
- assert(getID() != InvalidMappingID &&
- "Use the default constructor for invalid mapping");
}
/// Default constructor.
diff --git a/llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp b/llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp
index 55f10a2d065..9542c1fe1fc 100644
--- a/llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp
@@ -374,11 +374,8 @@ RegisterBankInfo::getInstructionMappingImpl(
++NumInstructionMappingsCreated;
auto &InstrMapping = MapOfInstructionMappings[Hash];
- if (IsInvalid)
- InstrMapping = llvm::make_unique<InstructionMapping>();
- else
- InstrMapping = llvm::make_unique<InstructionMapping>(
- ID, Cost, OperandsMapping, NumOperands);
+ InstrMapping = llvm::make_unique<InstructionMapping>(
+ ID, Cost, OperandsMapping, NumOperands);
return *InstrMapping;
}
OpenPOWER on IntegriCloud