Skip to content

Commit 2a30a6d

Browse files
committed
[flang] Remove needless "anyIntrinsicDefinedOps", fixing iterative expr analysis
The flag "anyIntrinsicDefinedOps" is always set nowadays, as there are intrinsic modules that define operator(==) and (!=). This disables the iterative expression analysis mechanism, also unnecessarily, and it is possible to overflow the stack when analyzing very deep expression trees like the ones that show up in artificial stress tests. Remove the flag. Differential Revision: https://reviews.llvm.org/D159022
1 parent de0df63 commit 2a30a6d

File tree

3 files changed

+1
-15
lines changed

3 files changed

+1
-15
lines changed

flang/include/flang/Semantics/semantics.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -144,14 +144,6 @@ class SemanticsContext {
144144
return *this;
145145
}
146146

147-
bool anyDefinedIntrinsicOperator() const {
148-
return anyDefinedIntrinsicOperator_;
149-
}
150-
SemanticsContext &set_anyDefinedIntrinsicOperator(bool yes = true) {
151-
anyDefinedIntrinsicOperator_ = yes;
152-
return *this;
153-
}
154-
155147
const DeclTypeSpec &MakeNumericType(TypeCategory, int kind = 0);
156148
const DeclTypeSpec &MakeLogicalType(int kind = 0);
157149

@@ -286,7 +278,6 @@ class SemanticsContext {
286278
const Scope *ppcBuiltinsScope_{nullptr}; // module __ppc_intrinsics
287279
std::list<parser::Program> modFileParseTrees_;
288280
std::unique_ptr<CommonBlockMap> commonBlockMap_;
289-
bool anyDefinedIntrinsicOperator_{false};
290281
};
291282

292283
class Semantics {

flang/lib/Semantics/expression.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3584,7 +3584,7 @@ MaybeExpr ExpressionAnalyzer::Analyze(const parser::Expr &expr) {
35843584
if (expr.typedExpr) {
35853585
return expr.typedExpr->v;
35863586
}
3587-
if (!wasIterativelyAnalyzing && !context_.anyDefinedIntrinsicOperator()) {
3587+
if (!wasIterativelyAnalyzing) {
35883588
iterativelyAnalyzingSubexpressions_ = true;
35893589
result = IterativelyAnalyzeSubexpressions(expr);
35903590
}

flang/lib/Semantics/resolve-names.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3269,11 +3269,6 @@ bool InterfaceVisitor::Pre(const parser::GenericSpec &x) {
32693269
if (auto *symbol{FindInScope(GenericSpecInfo{x}.symbolName())}) {
32703270
SetGenericSymbol(*symbol);
32713271
}
3272-
if (const auto *opr{std::get_if<parser::DefinedOperator>(&x.u)}; opr &&
3273-
std::holds_alternative<parser::DefinedOperator::IntrinsicOperator>(
3274-
opr->u)) {
3275-
context().set_anyDefinedIntrinsicOperator(true);
3276-
}
32773272
return false;
32783273
}
32793274

0 commit comments

Comments
 (0)