[PATCH] D89312: [SVE][CodeGen]Use TypeSize comparison operators in clang

Caroline via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 13 05:43:12 PDT 2020


CarolineConcatto created this revision.
Herald added subscribers: cfe-commits, psnobl, tschuett.
Herald added a reviewer: efriedma.
Herald added a project: clang.
CarolineConcatto requested review of this revision.

The patch replaces comparison greater/lower or equal than by
TypeSize::isKnownXY, where XY is: GE, GT, LE, LT
in the place where getPrimitiveSizeInBits is being used inside Clang.
TypeSize::isKnowXY is flexible and allows to compares mixing fixed
 width and scalable vector types.

This patch excludes:

- comparison with constant as in:

clang/lib/CodeGen/TargetInfo.cpp:2333 and

- constant type size as in: clang/lib/CodeGen/CGExpr.cpp:2992.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D89312

Files:
  clang/lib/CodeGen/CGBuiltin.cpp


Index: clang/lib/CodeGen/CGBuiltin.cpp
===================================================================
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -5599,8 +5599,8 @@
 
   Value *Result = CGF.EmitNeonCall(F, Ops, s);
   llvm::Type *ResultType = CGF.ConvertType(E->getType());
-  if (ResultType->getPrimitiveSizeInBits() <
-      Result->getType()->getPrimitiveSizeInBits())
+  if (TypeSize::isKnownLT(ResultType->getPrimitiveSizeInBits(),
+                          Result->getType()->getPrimitiveSizeInBits()))
     return CGF.Builder.CreateExtractElement(Result, C0);
 
   return CGF.Builder.CreateBitCast(Result, ResultType, s);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89312.297834.patch
Type: text/x-patch
Size: 666 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201013/8a3841e1/attachment-0001.bin>


More information about the cfe-commits mailing list