forked from OSchip/llvm-project
[flang] fold LOGICAL intrinsic calls
Folding of LOGICAL intrinsic procedure was missing in the front-end causing crash when using it in parameter expressions. Simply fold LOGICAL calls to evaluate::Convert<T>. Differential Revision: https://reviews.llvm.org/D99346
This commit is contained in:
parent
7f5abb6373
commit
27899112c6
|
@ -106,6 +106,10 @@ Expr<Type<TypeCategory::Logical, KIND>> FoldIntrinsicFunction(
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (name == "logical") {
|
||||
if (auto *expr{UnwrapExpr<Expr<SomeLogical>>(args[0])}) {
|
||||
return Fold(context, ConvertToType<T>(std::move(*expr)));
|
||||
}
|
||||
} else if (name == "merge") {
|
||||
return FoldMerge<T>(context, std::move(funcRef));
|
||||
} else if (name == "__builtin_ieee_support_datatype" ||
|
||||
|
|
|
@ -30,6 +30,9 @@ module m
|
|||
logical, parameter :: test_neqv3 = .NOT.(.false..NEQV..false.)
|
||||
logical, parameter :: test_neqv4 = .NOT.(.true..NEQV..true.)
|
||||
|
||||
logical, parameter :: test_logical1 = logical(logical(.true., 2))
|
||||
logical, parameter :: test_logical2 = .NOT.logical(logical(.false., 2))
|
||||
|
||||
! Check integer intrinsic operator folding
|
||||
|
||||
! Check integer relational intrinsic operation folding
|
||||
|
|
Loading…
Reference in New Issue