[PATCH] D124691: [Transforms] Fix a wrong debug info intrinsic call in `mem2reg` pass for ref 128-bit

Orlando Cazalet-Hyams via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 23 02:33:31 PDT 2022


Orlando added a comment.

Hi @slydiman,

It looks like the clang front end emits a size field for reference types. e.g.

  $ clang++ --version
  clang version 15.0.0 (https://github.com/llvm/llvm-project.git 8e9528cb544a3d70cea96f1f99318643095a1410)
  Target: x86_64-unknown-linux-gnu
  
  $ cat test.cpp
  void fun(__int128_t &i) {}
  
  $ clang++ test.cpp -Xclang -disable-llvm-passes -g -emit-llvm -S -o -
  ...
  !11 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !12, size: 64)
  !12 = !DIDerivedType(tag: DW_TAG_typedef, name: "__int128_t", file: !13, baseType: !14)
  !13 = !DIFile(filename: "test.cpp", directory: "/home/och/dev/bugs/scratch")
  !14 = !DIBasicType(name: "__int128", size: 128, encoding: DW_ATE_signed)
  !15 = !{}
  !16 = !DILocalVariable(name: "i", arg: 1, scope: !8, file: !1, line: 1, type: !11)

Notice that `i`'s (`!16`) type is `!11` which is a  `DW_TAG_reference_type` type `DIDerivedType` with a field `size: 64`. IIUC this means `valueCoversEntireFragment` should work correctly for this type without your patch.

Perhaps this can be fixed by patching your front end. Was your reproducer created using the clang front end?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124691



More information about the llvm-commits mailing list