[all-commits] [llvm/llvm-project] b14eb2: [mlir] Fix C++ name hiding bug in PDLPatternMatch ...
jumerckx via All-commits
all-commits at lists.llvm.org
Fri May 8 07:33:16 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: b14eb2fc0db35080e6da8df26e329e70ebae4552
https://github.com/llvm/llvm-project/commit/b14eb2fc0db35080e6da8df26e329e70ebae4552
Author: jumerckx <31353884+jumerckx at users.noreply.github.com>
Date: 2026-05-08 (Fri, 08 May 2026)
Changed paths:
M mlir/include/mlir/IR/PDLPatternMatch.h.inc
M mlir/test/lib/Tools/PDLL/TestPDLL.cpp
M mlir/test/lib/Tools/PDLL/TestPDLL.pdll
M mlir/test/mlir-pdll/Integration/test-pdll.mlir
Log Message:
-----------
[mlir] Fix C++ name hiding bug in PDLPatternMatch for Op classes (#195554)
Native constraints with a named operation operand type failed because of
name hiding in `ProcessPDLValue`.
i.e. previously a constraint like:
```
Constraint TestConstraintWithNamedOpOperand(testOp: Op<test.op_a>) [{
return success();
}];
```
would fail with:
```
In file included from /home/jumerckx/llvm-project/mlir/include/mlir/IR/PatternMatch.h:814,
from /home/jumerckx/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h:13,
from /home/jumerckx/llvm-project/mlir/include/mlir/Dialect/Bufferization/IR/Bufferization.h:14,
from /home/jumerckx/llvm-project/mlir/test/lib/Tools/PDLL/../../Dialect/Test/TestDialect.h:21,
from /home/jumerckx/llvm-project/mlir/test/lib/Tools/PDLL/TestPDLL.cpp:9:
/home/jumerckx/llvm-project/mlir/include/mlir/IR/PDLPatternMatch.h.inc: In instantiation of ‘typename FnTraitsT::result_t mlir::detail::pdl_function_builder::processArgsAndInvokeConstraint(PDLFnT&, mlir::PatternRewriter&, llvm::ArrayRef<mlir::PDLValue>, std::index_sequence<InputIndexes ...>) [with PDLFnT = llvm::LogicalResult (* const)(mlir::PatternRewriter&, test::OpA); long unsigned int ...I = {0}; FnTraitsT = llvm::function_traits<llvm::LogicalResult (* const)(mlir::PatternRewriter&, test::OpA), false>; typename FnTraitsT::result_t = llvm::LogicalResult; std::index_sequence<InputIndexes ...> = std::integer_sequence<long unsigned int, 0>]’:
/home/jumerckx/llvm-project/mlir/include/mlir/IR/PDLPatternMatch.h.inc:733:42: required from ‘std::enable_if_t<(! std::is_convertible<ConstraintFnT, std::function<llvm::LogicalResult(mlir::PatternRewriter&, mlir::PDLResultList&, llvm::ArrayRef<mlir::PDLValue>)> >::value), std::function<llvm::LogicalResult(mlir::PatternRewriter&, mlir::PDLResultList&, llvm::ArrayRef<mlir::PDLValue>)> > mlir::detail::pdl_function_builder::buildConstraintFn(ConstraintFnT&&) [with ConstraintFnT = llvm::LogicalResult (&)(mlir::PatternRewriter&, test::OpA); std::enable_if_t<(! std::is_convertible<ConstraintFnT, std::function<llvm::LogicalResult(mlir::PatternRewriter&, mlir::PDLResultList&, llvm::ArrayRef<mlir::PDLValue>)> >::value), std::function<llvm::LogicalResult(mlir::PatternRewriter&, mlir::PDLResultList&, llvm::ArrayRef<mlir::PDLValue>)> > = std::function<llvm::LogicalResult(mlir::PatternRewriter&, mlir::PDLResultList&, llvm::ArrayRef<mlir::PDLValue>)>]’
/home/jumerckx/llvm-project/mlir/include/mlir/IR/PDLPatternMatch.h.inc:868:79: required from ‘void mlir::PDLPatternModule::registerConstraintFunction(llvm::StringRef, ConstraintFnT&&) [with ConstraintFnT = llvm::LogicalResult (&)(mlir::PatternRewriter&, test::OpA)]’
/home/jumerckx/llvm-project/build/tools/mlir/test/lib/Tools/PDLL/TestPDLLPatterns.h.inc:64:31: required from ‘{anonymous}::GeneratedPDLLPattern0::GeneratedPDLLPattern0(mlir::MLIRContext*, ConfigsT&& ...) [with ConfigsT = {}]’
/home/jumerckx/llvm-project/mlir/include/mlir/IR/PatternMatch.h:1017:25: required from ‘std::enable_if_t<std::is_base_of<mlir::PDLPatternModule, T>::value> mlir::RewritePatternSet:addImpl(llvm::ArrayRef<llvm::StringRef>, Args&& ...) [with T = {anonymous}::GeneratedPDLLPattern0; Args = {mlir::MLIRContext*}; std::enable_if_t<std::is_base_of<mlir::PDLPatternModule, T>::value> = void]’
/home/jumerckx/llvm-project/mlir/include/mlir/IR/PatternMatch.h:864:17: required from ‘mlir::RewritePatternSet& mlir::RewritePatternSet::add(ConstructorArg&&, ConstructorArgs&& ...) [with Ts = {{anonymous}::GeneratedPDLLPattern0}; ConstructorArg = mlir::MLIRContext*; ConstructorArgs = {}; <template-parameter-1-4> = void]’
/home/jumerckx/llvm-project/build/tools/mlir/test/lib/Tools/PDLL/TestPDLLPatterns.h.inc:74:38: required from ‘void populateGeneratedPDLLPatterns(mlir::RewritePatternSet&, ConfigsT&& ...) [with ConfigsT = {}]’
/home/jumerckx/llvm-project/mlir/test/lib/Tools/PDLL/TestPDLL.cpp:36:34: required from here
/home/jumerckx/llvm-project/mlir/include/mlir/IR/PDLPatternMatch.h.inc:702:80: error: cannot convert ‘const mlir::PDLValue’ to ‘mlir::Operation*’
702 | (ProcessPDLValue<typename FnTraitsT::template arg_t<I + 1>>::processAsArg(
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
703 | values[I]))...);
| ~~~~~~~~~~~
/home/jumerckx/llvm-project/mlir/include/mlir/IR/PDLPatternMatch.h.inc:522:36: note: initializing argument 1 of ‘static T mlir::detail::pdl_function_builder::ProcessPDLValue<T, typename std::enable_if<std::is_base_of<mlir::OpState, T>::value, void>::type>::processAsArg(mlir::Operation*) [with T = test::OpA]’
522 | static T processAsArg(Operation *value) { return cast<T>(value); }
| ~~~~~~~~~~~^~~~~
```
This pr fixes that.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list