[llvm] r331887 - [Hexagon] Fix sanitizer error about using -1u in variable of enum type

Krzysztof Parzyszek via llvm-commits llvm-commits at lists.llvm.org
Wed May 9 08:44:40 PDT 2018


Author: kparzysz
Date: Wed May  9 08:44:40 2018
New Revision: 331887

URL: http://llvm.org/viewvc/llvm-project?rev=331887&view=rev
Log:
[Hexagon] Fix sanitizer error about using -1u in variable of enum type

Modified:
    llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCCodeEmitter.cpp

Modified: llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCCodeEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCCodeEmitter.cpp?rev=331887&r1=331886&r2=331887&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCCodeEmitter.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCCodeEmitter.cpp Wed May  9 08:44:40 2018
@@ -623,7 +623,7 @@ unsigned HexagonMCCodeEmitter::getExprOp
     return 0;
   }
 
-  Hexagon::Fixups FixupKind = Hexagon::Fixups(fixup_Invalid);
+  unsigned FixupKind = fixup_Invalid;
   const MCSymbolRefExpr *MCSRE = static_cast<const MCSymbolRefExpr *>(ME);
   const MCInstrDesc &MCID = HexagonMCInstrInfo::getDesc(MCII, MI);
   unsigned FixupWidth = HexagonMCInstrInfo::getExtentBits(MCII, MI) -
@@ -696,15 +696,15 @@ unsigned HexagonMCCodeEmitter::getExprOp
     }
   }
 
-  if (unsigned(FixupKind) == fixup_Invalid) {
+  if (FixupKind == fixup_Invalid) {
     const auto &FixupTable = State.Extended ? ExtFixups : StdFixups;
 
     auto FindVK = FixupTable.find(VarKind);
     if (FindVK != FixupTable.end())
-      FixupKind = Hexagon::Fixups(FindVK->second[FixupWidth]);
+      FixupKind = FindVK->second[FixupWidth];
   }
 
-  if (unsigned(FixupKind) == fixup_Invalid)
+  if (FixupKind == fixup_Invalid)
     raise_relocation_error(FixupWidth, VarKind);
 
   const MCExpr *FixupExpr = MO.getExpr();




More information about the llvm-commits mailing list