Skip to content

Commit f81bbfb

Browse files
bcardosolopesxlauko
authored andcommitted
[CIR] Raise std::find call to cir.std.find
Also implement lowering back to `std::call` before lowering to LLVM.
1 parent a023597 commit f81bbfb

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

clang/include/clang/CIR/Dialect/IR/CIROps.td

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1887,6 +1887,12 @@ def CallOp : CIR_Op<"call",
18871887
$_state.addOperands(operands);
18881888
if (!fn_type.isVoid())
18891889
$_state.addTypes(fn_type.getReturnType());
1890+
}]>,
1891+
OpBuilder<(ins "SymbolRefAttr":$callee, "mlir::Type":$resType,
1892+
CArg<"ValueRange", "{}">:$operands), [{
1893+
$_state.addOperands(operands);
1894+
$_state.addAttribute("callee", callee);
1895+
$_state.addTypes(resType);
18901896
}]>];
18911897

18921898
let extraClassDeclaration = [{

clang/test/CIR/Transforms/idiom-recognizer.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -fclangir -fclangir-idiom-recognizer -emit-cir -I%S/../Inputs -mmlir --mlir-print-ir-after=cir-idiom-recognizer %s -o - 2>&1 | FileCheck %s -check-prefix=AFTER-IDIOM
66
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -fclangir -fclangir-idiom-recognizer -emit-cir -I%S/../Inputs -mmlir --mlir-print-ir-after=cir-lowering-prepare %s -o - 2>&1 | FileCheck %s -check-prefix=AFTER-LOWERING-PREPARE
77

8+
// RUN: %clang_cc1 -fclangir -emit-cir -I%S/../Inputs -mmlir --mlir-print-ir-before=cir-idiom-recognizer -std=c++20 -triple x86_64-unknown-linux-gnu %s -o - 2>&1 | FileCheck %s -check-prefix=BEFORE-IDIOM
9+
// RUN: %clang_cc1 -fclangir -emit-cir -I%S/../Inputs -mmlir --mlir-print-ir-after=cir-idiom-recognizer -std=c++20 -triple x86_64-unknown-linux-gnu %s -o - 2>&1 | FileCheck %s -check-prefix=AFTER-IDIOM
10+
// RUN: %clang_cc1 -fclangir -emit-cir -I%S/../Inputs -mmlir --mlir-print-ir-after=cir-lowering-prepare -std=c++20 -triple x86_64-unknown-linux-gnu %s -o - 2>&1 | FileCheck %s -check-prefix=AFTER-LOWERING-PREPARE
11+
812
// PASS_ENABLED: IR Dump After IdiomRecognizer (cir-idiom-recognizer)
913

1014
#include "std-cxx.h"

0 commit comments

Comments
 (0)