[PATCH] D113581: [fir] Remove `fir.unbox` operation
Valentin Clement via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 10 10:00:27 PST 2021
clementval created this revision.
clementval added a reviewer: schweitz.
Herald added a project: Flang.
clementval requested review of this revision.
Herald added subscribers: llvm-commits, jdoerfert.
Herald added a project: LLVM.
`fir.unbox` operation is an old operation that is no longer required.
There are couple of other operations that can be used to extract
information from a `fir.box` such as `fir.box_rank`, `fir.box_addr`,
`fir.box_dims`.
This was found during the upstreaming process.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D113581
Files:
flang/include/flang/Optimizer/Dialect/FIROps.td
flang/test/Fir/fir-ops.fir
Index: flang/test/Fir/fir-ops.fir
===================================================================
--- flang/test/Fir/fir-ops.fir
+++ flang/test/Fir/fir-ops.fir
@@ -142,7 +142,6 @@
// CHECK: [[VAL_40:%.*]] = fir.alloca !fir.char<1>
// CHECK: [[VAL_41:%.*]] = fir.alloca tuple<i32, f64>
// CHECK: [[VAL_42:%.*]] = fir.embox [[VAL_38]] : (!fir.ref<i32>) -> !fir.box<i32>
-// CHECK: [[VAL_43:%.*]]:6 = fir.unbox [[VAL_42]] : (!fir.box<i32>) -> (!fir.ref<i32>, i32, i32, !fir.tdesc<i32>, i32, !fir.array<3x?xindex>)
// CHECK: [[VAL_44:%.*]] = arith.constant 8 : i32
// CHECK: [[VAL_45:%.*]] = fir.undefined !fir.char<1>
// CHECK: [[VAL_46:%.*]] = fir.emboxchar [[VAL_40]], [[VAL_44]] : (!fir.ref<!fir.char<1>>, i32) -> !fir.boxchar<1>
@@ -168,7 +167,6 @@
%d3 = fir.alloca !fir.char<1>
%e6 = fir.alloca tuple<i32,f64>
%1 = fir.embox %0 : (!fir.ref<i32>) -> !fir.box<i32>
- %2:6 = fir.unbox %1 : (!fir.box<i32>) -> (!fir.ref<i32>,i32,i32,!fir.tdesc<i32>,i32,!fir.array<3x?xindex>)
%c8 = arith.constant 8 : i32
%3 = fir.undefined !fir.char<1>
%4 = fir.emboxchar %d3, %c8 : (!fir.ref<!fir.char<1>>, i32) -> !fir.boxchar<1>
Index: flang/include/flang/Optimizer/Dialect/FIROps.td
===================================================================
--- flang/include/flang/Optimizer/Dialect/FIROps.td
+++ flang/include/flang/Optimizer/Dialect/FIROps.td
@@ -1019,34 +1019,6 @@
let verifier = "return ::verify(*this);";
}
-def fir_UnboxOp : fir_SimpleOp<"unbox", [NoSideEffect]> {
- let summary = "unbox the boxed value into a tuple value";
-
- let description = [{
- Unbox a boxed value into a result of multiple values from the box's
- component data. The values are, minimally, a reference to the data of the
- entity, the byte-size of one element, the rank, the type descriptor, a set
- of flags (packed in an integer, and an array of dimension information (of
- size rank).
-
- ```mlir
- %40 = ... : !fir.box<!fir.type<T>>
- %41:6 = fir.unbox %40 : (!fir.box<!fir.type<T>>) -> (!fir.ref<!fir.type<T>>, i32, i32, !fir.tdesc<!fir.type<T>>, i32, !fir.array<? x index>)
- ```
- }];
-
- let arguments = (ins fir_BoxType:$box);
-
- let results = (outs
- fir_ReferenceType, // pointer to data
- AnyIntegerLike, // size of a data element
- AnyIntegerLike, // rank of data
- fir_TypeDescType, // abstract type descriptor
- AnyIntegerLike, // attribute flags (bitfields)
- fir_SequenceType // dimension information (if any)
- );
-}
-
def fir_UnboxCharOp : fir_SimpleOp<"unboxchar", [NoSideEffect]> {
let summary = "unbox a boxchar value into a pair value";
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113581.386215.patch
Type: text/x-patch
Size: 2655 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211110/7c8dedc0/attachment.bin>
More information about the llvm-commits
mailing list