[clang] [CIR] Implement folder for VecCreateOp (PR #143355)
Henrich Lauko via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 10 04:28:17 PDT 2025
================
@@ -1533,6 +1533,16 @@ LogicalResult cir::GetMemberOp::verify() {
// VecCreateOp
//===----------------------------------------------------------------------===//
+OpFoldResult cir::VecCreateOp::fold(FoldAdaptor adaptor) {
+ if (llvm::any_of(getElements(), [](mlir::Value attr) {
+ return !mlir::isa<cir::ConstantOp>(attr.getDefiningOp());
+ }))
+ return {};
----------------
xlauko wrote:
```suggestion
if (llvm::any_of(getElements(), [](mlir::Value value) {
return !mlir::isa<cir::ConstantOp>(value.getDefiningOp());
}))
return {};
```
https://github.com/llvm/llvm-project/pull/143355
More information about the cfe-commits
mailing list