[llvm] r294259 - Revert "[Hexagon] Address ASAN and UBSAN failures after r294226"
Krzysztof Parzyszek via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 6 15:30:17 PST 2017
Author: kparzysz
Date: Mon Feb 6 17:30:17 2017
New Revision: 294259
URL: http://llvm.org/viewvc/llvm-project?rev=294259&view=rev
Log:
Revert "[Hexagon] Address ASAN and UBSAN failures after r294226"
This reverts commit r294256. It seems to be causing more problems instead
of solving them.
Modified:
llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.cpp
llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.h
llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonShuffler.cpp
Modified: llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.cpp?rev=294259&r1=294258&r2=294259&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.cpp Mon Feb 6 17:30:17 2017
@@ -78,7 +78,7 @@ bool HexagonMCInstrInfo::canonicalizePac
}
// Examines packet and pad the packet, if needed, when an
// end-loop is in the bundle.
- HexagonMCInstrInfo::padEndloop(MCB, Context);
+ HexagonMCInstrInfo::padEndloop(MCB);
// If compounding and duplexing didn't reduce the size below
// 4 or less we have a packet that is too big.
if (HexagonMCInstrInfo::bundleSize(MCB) > HEXAGON_PACKET_SIZE)
@@ -273,8 +273,9 @@ int HexagonMCInstrInfo::getMaxValue(MCIn
HexagonMCInstrInfo::isExtended(MCII, MCI));
if (S) // if value is signed
- return (1 << (HexagonMCInstrInfo::getExtentBits(MCII, MCI) - 1)) - 1;
- return (1 << HexagonMCInstrInfo::getExtentBits(MCII, MCI)) - 1;
+ return ~(-1 << (HexagonMCInstrInfo::getExtentBits(MCII, MCI) - 1));
+ else
+ return ~(-1 << HexagonMCInstrInfo::getExtentBits(MCII, MCI));
}
/// Return the minimum value of an extendable operand.
@@ -287,8 +288,9 @@ int HexagonMCInstrInfo::getMinValue(MCIn
HexagonMCInstrInfo::isExtended(MCII, MCI));
if (S) // if value is signed
- return -(1 << (HexagonMCInstrInfo::getExtentBits(MCII, MCI) - 1));
- return 0;
+ return -1 << (HexagonMCInstrInfo::getExtentBits(MCII, MCI) - 1);
+ else
+ return 0;
}
StringRef HexagonMCInstrInfo::getName(MCInstrInfo const &MCII,
@@ -745,7 +747,7 @@ bool HexagonMCInstrInfo::s23_2_reloc(MCE
return HExpr->s23_2_reloc();
}
-void HexagonMCInstrInfo::padEndloop(MCInst &MCB, MCContext &Context) {
+void HexagonMCInstrInfo::padEndloop(MCInst &MCB) {
MCInst Nop;
Nop.setOpcode(Hexagon::A2_nop);
assert(isBundle(MCB));
@@ -753,7 +755,7 @@ void HexagonMCInstrInfo::padEndloop(MCIn
(HexagonMCInstrInfo::bundleSize(MCB) < HEXAGON_PACKET_INNER_SIZE)) ||
((HexagonMCInstrInfo::isOuterLoop(MCB) &&
(HexagonMCInstrInfo::bundleSize(MCB) < HEXAGON_PACKET_OUTER_SIZE))))
- MCB.addOperand(MCOperand::createInst(new (Context) MCInst(Nop)));
+ MCB.addOperand(MCOperand::createInst(new MCInst(Nop)));
}
bool HexagonMCInstrInfo::prefersSlot3(MCInstrInfo const &MCII,
Modified: llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.h?rev=294259&r1=294258&r2=294259&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.h (original)
+++ llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.h Mon Feb 6 17:30:17 2017
@@ -256,7 +256,7 @@ bool mustExtend(MCExpr const &Expr);
bool mustNotExtend(MCExpr const &Expr);
// Pad the bundle with nops to satisfy endloop requirements
-void padEndloop(MCInst &MCI, MCContext &Context);
+void padEndloop(MCInst &MCI);
bool prefersSlot3(MCInstrInfo const &MCII, MCInst const &MCI);
// Replace the instructions inside MCB, represented by Candidate
Modified: llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonShuffler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonShuffler.cpp?rev=294259&r1=294258&r2=294259&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonShuffler.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonShuffler.cpp Mon Feb 6 17:30:17 2017
@@ -80,19 +80,15 @@ public:
unsigned HexagonResource::setWeight(unsigned s) {
const unsigned SlotWeight = 8;
const unsigned MaskWeight = SlotWeight - 1;
- unsigned Units = getUnits();
- unsigned Key = ((1u << s) & Units) != 0;
+ bool Key = (1 << s) & getUnits();
// Calculate relative weight of the insn for the given slot, weighing it the
// heavier the more restrictive the insn is and the lowest the slots that the
// insn may be executed in.
- if (Key == 0 || Units == 0 || (SlotWeight*s > 32))
- return 0;
-
Weight =
- (1u << (SlotWeight * s)) * ((MaskWeight - countPopulation(getUnits()))
+ (Key << (SlotWeight * s)) * ((MaskWeight - countPopulation(getUnits()))
<< countTrailingZeros(getUnits()));
- return Weight;
+ return (Weight);
}
void HexagonCVIResource::SetupTUL(TypeUnitsAndLanes *TUL, StringRef CPU) {
More information about the llvm-commits
mailing list