[PATCH] D130513: [Flang] Add -fconvert option to swap endianness for unformatted files

Peixin Qiao via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 2 09:16:09 PDT 2022


peixin added a comment.

Mostly LGTM. Have several more comments.



================
Comment at: flang/lib/Lower/Bridge.cpp:279
+    // are compiled separately.
+    if (hasMainProgram) {
+      createGlobalOutsideOfFunctionLowering([&]() {
----------------
Nit


================
Comment at: flang/lib/Optimizer/Builder/Runtime/EnvironmentDefaults.cpp:19
+    const std::vector<Fortran::runtime::EnvironmentDefault> &envDefaults) {
+  std::string envDefaultListPtrName =
+      fir::NameUniquer::doEnvironmentDefaultList().str();
----------------
```
  if (builder.getNamedGlobal(envDefaultListPtrName))
    return;
```
I don't think this and doEnvironmentDefaultList are necessary.


================
Comment at: flang/test/Driver/emit-mlir.f90:16
 ! CHECK-NEXT: }
+! CHECK-NEXT: fir.global @_QQEnvironmentDefaults constant : !fir.ref<tuple<i[[int_size:.*]], !fir.ref<!fir.array<0xtuple<!fir.ref<i8>, !fir.ref<i8>>>>>> {
+! CHECK-NEXT:  %[[VAL_0:.*]] = fir.zero_bits !fir.ref<tuple<i[[int_size]], !fir.ref<!fir.array<0xtuple<!fir.ref<i8>, !fir.ref<i8>>>>>>
----------------
Is it possible not to generated this global variable if `fconvert=` is not specified?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130513/new/

https://reviews.llvm.org/D130513



More information about the cfe-commits mailing list