[all-commits] [llvm/llvm-project] 0e7184: [SimplifyIndVar] Use enum class for ExtendKind. NFC

Craig Topper via All-commits all-commits at lists.llvm.org
Thu Jul 14 10:06:50 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0e718443c71ee9501d088e792cf5eb81aec2eda0
      https://github.com/llvm/llvm-project/commit/0e718443c71ee9501d088e792cf5eb81aec2eda0
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2022-07-14 (Thu, 14 Jul 2022)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyIndVar.cpp

  Log Message:
  -----------
  [SimplifyIndVar] Use enum class for ExtendKind. NFC

I happened to notice a two places where the enum was being pass
directly to the bool IsSigned argument of createExtendInst. This
was functionally ok since SignExtended in the enum has value
of 1, but the code shouldn't rely on that.

Using an enum class prevents the enum from being convertible to bool,
but does make writing the enum values more verbose. Since we now
have to write ExtendKind:: in front of them, I've shortened the
names of ZeroExtended and SignExtended.

Reviewed By: nikic

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




More information about the All-commits mailing list