Skip to content

Commit 46c91fd

Browse files
committedOct 8, 2018
TableGen/CodeGenDAGPatterns: addPredicateFn only once
Summary: The predicate function is added in InlinePatternFragments, no need to do it here. As a result, all uses of addPredicateFn are located in InlinePatternFragments. Test confirmed that there are no changes to generated files when building all (non-experimental) targets. Change-Id: I720e42e045ca596eb0aa339fb61adf6fe71034d5 Reviewers: arsenm, rampitec, RKSimon, craig.topper, hfinkel, uweigand Subscribers: wdng, llvm-commits Differential Revision: https://reviews.llvm.org/D51993 llvm-svn: 343977
1 parent 8dd9248 commit 46c91fd

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed
 

‎llvm/utils/TableGen/CodeGenDAGPatterns.cpp

-7
Original file line numberDiff line numberDiff line change
@@ -3037,13 +3037,6 @@ void CodeGenDAGPatterns::ParsePatternFragments(bool OutFrags) {
30373037
P->error("Operands list does not contain an entry for operand '" +
30383038
*OperandsSet.begin() + "'!");
30393039

3040-
// If there is a code init for this fragment, keep track of the fact that
3041-
// this fragment uses it.
3042-
TreePredicateFn PredFn(P);
3043-
if (!PredFn.isAlwaysTrue())
3044-
for (auto T : P->getTrees())
3045-
T->addPredicateFn(PredFn);
3046-
30473040
// If there is a node transformation corresponding to this, keep track of
30483041
// it.
30493042
Record *Transform = Frag->getValueAsDef("OperandTransform");

‎llvm/utils/TableGen/CodeGenDAGPatterns.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -673,8 +673,8 @@ class TreePatternNode {
673673
}
674674
void addPredicateFn(const TreePredicateFn &Fn) {
675675
assert(!Fn.isAlwaysTrue() && "Empty predicate string!");
676-
if (!is_contained(PredicateFns, Fn))
677-
PredicateFns.push_back(Fn);
676+
assert(!is_contained(PredicateFns, Fn) && "predicate applied recursively");
677+
PredicateFns.push_back(Fn);
678678
}
679679

680680
Record *getTransformFn() const { return TransformFn; }

0 commit comments

Comments
 (0)
Please sign in to comment.