Minor fixes on the typo/naming/style in the Pattern.cpp file

--

PiperOrigin-RevId: 241341334
This commit is contained in:
Feng Liu 2019-04-01 09:39:59 -07:00 committed by Mehdi Amini
parent b9e38a7972
commit a0606ca717
1 changed files with 7 additions and 5 deletions

View File

@ -266,11 +266,13 @@ std::vector<tblgen::AppliedConstraint> tblgen::Pattern::getConstraints() const {
}
int tblgen::Pattern::getBenefit() const {
// The default benefit value is a heristic with number of ops in the source
// The initial benefit value is a heuristic with number of ops in the source
// pattern.
int defaultBenefit = getSourcePattern().getNumOps();
int initBenefit = getSourcePattern().getNumOps();
llvm::DagInit *delta = def.getValueAsDag("benefitDelta");
if (delta->getNumArgs() != 1 || !isa<llvm::IntInit>(delta->getArg(0)))
PrintFatalError(def.getLoc(), "The 'AddedBenefit' can only be an integer");
return defaultBenefit + dyn_cast<llvm::IntInit>(delta->getArg(0))->getValue();
if (delta->getNumArgs() != 1 || !isa<llvm::IntInit>(delta->getArg(0))) {
PrintFatalError(def.getLoc(),
"The 'addBenefit' takes and only takes one integer value");
}
return initBenefit + dyn_cast<llvm::IntInit>(delta->getArg(0))->getValue();
}