[all-commits] [llvm/llvm-project] 72f863: [CodeGen] Use getCharWidth() more consistently in ...

Björn Pettersson via All-commits all-commits at lists.llvm.org
Fri Jan 22 12:15:00 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 72f863fd37c3471e7e1b152ac613da00ab6faaba
      https://github.com/llvm/llvm-project/commit/72f863fd37c3471e7e1b152ac613da00ab6faaba
  Author: Bjorn Pettersson <bjorn.a.pettersson at ericsson.com>
  Date:   2021-01-22 (Fri, 22 Jan 2021)

  Changed paths:
    M clang/lib/CodeGen/CGRecordLayoutBuilder.cpp

  Log Message:
  -----------
  [CodeGen] Use getCharWidth() more consistently in CGRecordLowering. NFC

When using getByteArrayType the requested size is calculated in
char units, but the type used for the array was hardcoded to the
Int8Ty. This patch is using getCharWIdth a bit more consistently
by using getIntNTy in combination with getCharWidth, instead
of explictly using getInt8Ty.

Reviewed By: rjmccall

Differential Revision: https://reviews.llvm.org/D94977


  Commit: ea2cfda386f1a0f0b8cab06a9400bbf4cf7bfbaa
      https://github.com/llvm/llvm-project/commit/ea2cfda386f1a0f0b8cab06a9400bbf4cf7bfbaa
  Author: Bjorn Pettersson <bjorn.a.pettersson at ericsson.com>
  Date:   2021-01-22 (Fri, 22 Jan 2021)

  Changed paths:
    M clang/lib/CodeGen/CGExprConstant.cpp
    M clang/lib/CodeGen/CodeGenModule.cpp
    M clang/lib/CodeGen/CodeGenTypeCache.h

  Log Message:
  -----------
  [CGExpr] Use getCharWidth() more consistently in CCGExprConstant. NFC

Most of CGExprConstant.cpp is using the CharUnits abstraction
and is using getCharWidth() (directly of indirectly) when converting
between size of a char and size in bits. This patch is making that
abstraction more consistent by adding CharTy to the CodeGenTypeCache
(honoring getCharWidth() when mapping from char to LLVM IR types,
instead of using Int8Ty directly).

Reviewed By: rjmccall

Differential Revision: https://reviews.llvm.org/D94979


Compare: https://github.com/llvm/llvm-project/compare/29d420e0bf02...ea2cfda386f1


More information about the All-commits mailing list