[PATCH] D50623: [NFC] [Hexagon] Simplify int8 truncation and validation

Kim Gräsman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 13 01:26:59 PDT 2018


kimgr created this revision.
kimgr added reviewers: kparzysz, llvm-commits.

Silences a -Wuninitialized false positive from GCC 7.2.


Repository:
  rL LLVM

https://reviews.llvm.org/D50623

Files:
  lib/Target/Hexagon/HexagonBitSimplify.cpp


Index: lib/Target/Hexagon/HexagonBitSimplify.cpp
===================================================================
--- lib/Target/Hexagon/HexagonBitSimplify.cpp
+++ lib/Target/Hexagon/HexagonBitSimplify.cpp
@@ -1974,18 +1974,10 @@
     return false;
 
   // Only consider 8-bit values to avoid constant-extenders.
-  int V;
-  switch (Opc) {
-    case Hexagon::S2_storerb_io:
-      V = int8_t(U);
-      break;
-    case Hexagon::S2_storerh_io:
-      V = int16_t(U);
-      break;
-    case Hexagon::S2_storeri_io:
-      V = int32_t(U);
-      break;
-  }
+  assert (Opc == Hexagon::S2_storerb_io ||
+          Opc == Hexagon::S2_storerh_io ||
+          Opc == Hexagon::S2_storeri_io);
+  int64_t V = U;
   if (!isInt<8>(V))
     return false;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50623.160305.patch
Type: text/x-patch
Size: 752 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180813/d1ae300d/attachment.bin>


More information about the llvm-commits mailing list