Skip to content

Commit 9f6596e

Browse files
cmarcelolanza
authored andcommitted
[CIR][CodeGen] Add missing conversion patterns for ControlFlowDialect
Fixes #4.
1 parent d408e18 commit 9f6596e

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

clang/lib/CIR/CodeGen/LowerToLLVM.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include "mlir/Conversion/AffineToStandard/AffineToStandard.h"
1414
#include "mlir/Conversion/ArithmeticToLLVM/ArithmeticToLLVM.h"
15+
#include "mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h"
1516
#include "mlir/Conversion/FuncToLLVM/ConvertFuncToLLVM.h"
1617
#include "mlir/Conversion/FuncToLLVM/ConvertFuncToLLVMPass.h"
1718
#include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
@@ -462,6 +463,8 @@ void ConvertCIRToLLVMPass::runOnOperation() {
462463
mlir::arith::populateArithmeticToLLVMConversionPatterns(typeConverter,
463464
patterns);
464465
populateSCFToControlFlowConversionPatterns(patterns);
466+
mlir::cf::populateControlFlowToLLVMConversionPatterns(typeConverter,
467+
patterns);
465468
populateMemRefToLLVMConversionPatterns(typeConverter, patterns);
466469
populateFuncToLLVMConversionPatterns(typeConverter, patterns);
467470

clang/test/CIR/CIRToLLVM/goto.cir

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
// RUN: cir-tool %s -canonicalize -cir-to-func -cir-to-memref -o - | FileCheck %s -check-prefix=MLIR
22
// RUN: cir-tool %s -canonicalize -cir-to-func -cir-to-memref -cir-to-llvm -o - | mlir-translate -mlir-to-llvmir | FileCheck %s -check-prefix=LLVM
33

4-
// FIXME: after rebasing against July's 2022 mlir, we get "failed to legalize
5-
// operation 'cf.br'" from -cir-to-llvm
6-
// XFAIL: *
7-
84
module {
95
cir.func @foo() {
106
%0 = cir.alloca i32, cir.ptr <i32>, ["b", cinit] {alignment = 4 : i64}

0 commit comments

Comments
 (0)