[PATCH] D105423: Add support for zero-sized Scalars as a LowLevelType

Thomas Lively via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 21 17:08:53 PDT 2021


tlively accepted this revision.
tlively added a comment.
This revision is now accepted and ready to land.

LGTM with that final simplification.



================
Comment at: llvm/include/llvm/Support/LowLevelTypeImpl.h:127
+  bool isScalar() const {
+    return isValid() && IsScalar && !IsPointer && !IsVector;
+  }
----------------
pmatos wrote:
> tlively wrote:
> > Why isn't it sufficient to do `return IsScalar`? If `isScalar()` and `IsScalar` have different meanings, could that be clarified in the names?
> It's true that you could just do `isValid() && IsScalar`, however the other checks are extra to ensure the type was correctly built. Since you could in principle create an LLT where all the bits are 1 (`IsScalar && IsPointer && IsVector`), this check ensures that a true scalar doesn't have those. On the other hand, this check probably belongs elsewhere. Maybe in `init`... I will change this. 
Now this can be simplified to `return IsScalar` because `isValid()` is true if `IsScalar` is true.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105423



More information about the llvm-commits mailing list