[all-commits] [llvm/llvm-project] ce2a3d: [flang] Match the type of the element size in the ...

Kelvin Li via All-commits all-commits at lists.llvm.org
Tue Aug 6 15:23:27 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ce2a3d9042c95630f12b790bf201c4daf8941afb
      https://github.com/llvm/llvm-project/commit/ce2a3d9042c95630f12b790bf201c4daf8941afb
  Author: Kelvin Li <kkwli at users.noreply.github.com>
  Date:   2024-08-06 (Tue, 06 Aug 2024)

  Changed paths:
    M flang/lib/Optimizer/CodeGen/FIROpPatterns.cpp
    M flang/test/Fir/box-typecode.fir
    M flang/test/Fir/convert-to-llvm.fir
    M flang/test/Fir/polymorphic.fir
    M flang/test/Fir/tbaa.fir
    M flang/test/Lower/allocatable-polymorphic.f90

  Log Message:
  -----------
  [flang] Match the type of the element size in the box in getValueFromBox (#100512)

Currently, `%17 = fir.box_elesize %16 :
(!fir.class<!fir.ptr<!fir.type<_QFTt{a:i32,b:i32}>>>) -> i32`
is translated to
```
  %4 = getelementptr { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] }, ptr %1, i32 0, i32 1
  %5 = load i32, ptr %4, align 4
```
The type of the element size is `i64`. The load essentially truncates
the value and yields incorrect result in the big endian environment. The
problem occurs in the `storage_size` intrinsic on a polymorphic
variable.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list