diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td --- a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td +++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td @@ -732,7 +732,7 @@ let builders = [LLVM_OneResultOpBuilder]; let assemblyFormat = "$val attr-dict `:` type($val)"; string llvmInstName = "Freeze"; - string llvmBuilder = "builder.CreateFreeze($val);"; + string llvmBuilder = "$res = builder.CreateFreeze($val);"; string mlirBuilder = [{ $res = $_builder.create($_location, $val); }]; diff --git a/mlir/test/Target/LLVMIR/llvmir.mlir b/mlir/test/Target/LLVMIR/llvmir.mlir --- a/mlir/test/Target/LLVMIR/llvmir.mlir +++ b/mlir/test/Target/LLVMIR/llvmir.mlir @@ -1501,6 +1501,16 @@ llvm.return } +// CHECK-LABEL: @freezeUsed +llvm.func @freezeUsed(%x : i32) -> i64 { + // CHECK: %[[frozen:.*]] = freeze i32 + %frozen = llvm.freeze %x : i32 + // CHECK: %[[ext:.*]] = sext i32 %[[frozen]] to i64 + %ext = llvm.sext %frozen : i32 to i64 + // CHECK: ret i64 %[[ext]] + llvm.return %ext : i64 +} + // CHECK-LABEL: @boolConstArg llvm.func @boolConstArg() -> i1 { // CHECK: ret i1 false