forked from OSchip/llvm-project
[Hexagon] Fix check for HMOTF_ConstExtend operand flag
This fixes https://llvm.org/PR33718. llvm-svn: 307566
This commit is contained in:
parent
b03c2b4b09
commit
df4a05d6fb
|
@ -1830,7 +1830,7 @@ bool HexagonInstrInfo::isConstExtended(const MachineInstr &MI) const {
|
|||
const MachineOperand &MO = MI.getOperand(ExtOpNum);
|
||||
// Use MO operand flags to determine if MO
|
||||
// has the HMOTF_ConstExtended flag set.
|
||||
if (MO.getTargetFlags() && HexagonII::HMOTF_ConstExtended)
|
||||
if (MO.getTargetFlags() & HexagonII::HMOTF_ConstExtended)
|
||||
return true;
|
||||
// If this is a Machine BB address we are talking about, and it is
|
||||
// not marked as extended, say so.
|
||||
|
@ -1840,9 +1840,6 @@ bool HexagonInstrInfo::isConstExtended(const MachineInstr &MI) const {
|
|||
// We could be using an instruction with an extendable immediate and shoehorn
|
||||
// a global address into it. If it is a global address it will be constant
|
||||
// extended. We do this for COMBINE.
|
||||
// We currently only handle isGlobal() because it is the only kind of
|
||||
// object we are going to end up with here for now.
|
||||
// In the future we probably should add isSymbol(), etc.
|
||||
if (MO.isGlobal() || MO.isSymbol() || MO.isBlockAddress() ||
|
||||
MO.isJTI() || MO.isCPI() || MO.isFPImm())
|
||||
return true;
|
||||
|
@ -1994,11 +1991,9 @@ bool HexagonInstrInfo::isExtended(const MachineInstr &MI) const {
|
|||
return true;
|
||||
// Use MO operand flags to determine if one of MI's operands
|
||||
// has HMOTF_ConstExtended flag set.
|
||||
for (MachineInstr::const_mop_iterator I = MI.operands_begin(),
|
||||
E = MI.operands_end(); I != E; ++I) {
|
||||
if (I->getTargetFlags() && HexagonII::HMOTF_ConstExtended)
|
||||
for (const MachineOperand &MO : MI.operands())
|
||||
if (MO.getTargetFlags() & HexagonII::HMOTF_ConstExtended)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -110,10 +110,11 @@ SchedCustomRegistry("hexagon", "Run Hexagon's custom scheduler",
|
|||
namespace llvm {
|
||||
extern char &HexagonExpandCondsetsID;
|
||||
void initializeHexagonExpandCondsetsPass(PassRegistry&);
|
||||
void initializeHexagonLoopIdiomRecognizePass(PassRegistry&);
|
||||
void initializeHexagonGenMuxPass(PassRegistry&);
|
||||
void initializeHexagonOptAddrModePass(PassRegistry&);
|
||||
void initializeHexagonLoopIdiomRecognizePass(PassRegistry&);
|
||||
void initializeHexagonNewValueJumpPass(PassRegistry&);
|
||||
void initializeHexagonOptAddrModePass(PassRegistry&);
|
||||
void initializeHexagonPacketizerPass(PassRegistry&);
|
||||
Pass *createHexagonLoopIdiomPass();
|
||||
|
||||
FunctionPass *createHexagonBitSimplify();
|
||||
|
@ -156,10 +157,11 @@ extern "C" void LLVMInitializeHexagonTarget() {
|
|||
RegisterTargetMachine<HexagonTargetMachine> X(getTheHexagonTarget());
|
||||
|
||||
PassRegistry &PR = *PassRegistry::getPassRegistry();
|
||||
initializeHexagonLoopIdiomRecognizePass(PR);
|
||||
initializeHexagonGenMuxPass(PR);
|
||||
initializeHexagonOptAddrModePass(PR);
|
||||
initializeHexagonLoopIdiomRecognizePass(PR);
|
||||
initializeHexagonNewValueJumpPass(PR);
|
||||
initializeHexagonOptAddrModePass(PR);
|
||||
initializeHexagonPacketizerPass(PR);
|
||||
}
|
||||
|
||||
HexagonTargetMachine::HexagonTargetMachine(const Target &T, const Triple &TT,
|
||||
|
|
|
@ -60,9 +60,7 @@ namespace {
|
|||
class HexagonPacketizer : public MachineFunctionPass {
|
||||
public:
|
||||
static char ID;
|
||||
HexagonPacketizer() : MachineFunctionPass(ID) {
|
||||
initializeHexagonPacketizerPass(*PassRegistry::getPassRegistry());
|
||||
}
|
||||
HexagonPacketizer() : MachineFunctionPass(ID) {}
|
||||
|
||||
void getAnalysisUsage(AnalysisUsage &AU) const override {
|
||||
AU.setPreservesCFG();
|
||||
|
@ -89,14 +87,14 @@ namespace {
|
|||
char HexagonPacketizer::ID = 0;
|
||||
}
|
||||
|
||||
INITIALIZE_PASS_BEGIN(HexagonPacketizer, "packets", "Hexagon Packetizer",
|
||||
false, false)
|
||||
INITIALIZE_PASS_BEGIN(HexagonPacketizer, "hexagon-packetizer",
|
||||
"Hexagon Packetizer", false, false)
|
||||
INITIALIZE_PASS_DEPENDENCY(MachineDominatorTree)
|
||||
INITIALIZE_PASS_DEPENDENCY(MachineBranchProbabilityInfo)
|
||||
INITIALIZE_PASS_DEPENDENCY(MachineLoopInfo)
|
||||
INITIALIZE_PASS_DEPENDENCY(AAResultsWrapperPass)
|
||||
INITIALIZE_PASS_END(HexagonPacketizer, "packets", "Hexagon Packetizer",
|
||||
false, false)
|
||||
INITIALIZE_PASS_END(HexagonPacketizer, "hexagon-packetizer",
|
||||
"Hexagon Packetizer", false, false)
|
||||
|
||||
HexagonPacketizerList::HexagonPacketizerList(MachineFunction &MF,
|
||||
MachineLoopInfo &MLI, AliasAnalysis *AA,
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
# RUN: llc -march=hexagon -run-pass hexagon-packetizer -o - %s | FileCheck %s
|
||||
---
|
||||
name: fred
|
||||
tracksRegLiveness: true
|
||||
|
||||
body: |
|
||||
bb.0:
|
||||
; Check that all these instructions go in the same packet. This is to
|
||||
; make sure that a target flag (other than HMOTF_ConstExtend) on an
|
||||
; operand will not be interpreted as a constant-extender flag.
|
||||
; The combination used below (pcrel + 0) does not technically make sense,
|
||||
; but combinations that do make sense require constant extending, so
|
||||
; testing this is not possible otherwise.
|
||||
|
||||
; CHECK: BUNDLE
|
||||
; CHECK-DAG: %r0 = A2_tfrsi
|
||||
; CHECK-DAG: %r1 = A2_tfrsi
|
||||
; CHECK-DAG: %r2 = A2_tfrsi
|
||||
; CHECK: }
|
||||
%r0 = A2_tfrsi target-flags (hexagon-pcrel) 0
|
||||
%r1 = A2_tfrsi target-flags (hexagon-pcrel) 0
|
||||
%r2 = A2_tfrsi target-flags (hexagon-pcrel) 0
|
||||
...
|
||||
|
Loading…
Reference in New Issue