This repository was archived by the owner on Feb 5, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +401
-4
lines changed Expand file tree Collapse file tree 6 files changed +401
-4
lines changed Original file line number Diff line number Diff line change @@ -381,6 +381,7 @@ struct MachineFunction {
381
381
StringRef Name;
382
382
unsigned Alignment = 0 ;
383
383
bool ExposesReturnsTwice = false ;
384
+ bool NoVRegs;
384
385
// GISel MachineFunctionProperties.
385
386
bool Legalized = false ;
386
387
bool RegBankSelected = false ;
@@ -405,6 +406,7 @@ template <> struct MappingTraits<MachineFunction> {
405
406
YamlIO.mapRequired (" name" , MF.Name );
406
407
YamlIO.mapOptional (" alignment" , MF.Alignment );
407
408
YamlIO.mapOptional (" exposesReturnsTwice" , MF.ExposesReturnsTwice );
409
+ YamlIO.mapOptional (" noVRegs" , MF.NoVRegs );
408
410
YamlIO.mapOptional (" legalized" , MF.Legalized );
409
411
YamlIO.mapOptional (" regBankSelected" , MF.RegBankSelected );
410
412
YamlIO.mapOptional (" selected" , MF.Selected );
Original file line number Diff line number Diff line change @@ -330,6 +330,8 @@ bool MIRParserImpl::initializeMachineFunction(MachineFunction &MF) {
330
330
MF.setAlignment (YamlMF.Alignment );
331
331
MF.setExposesReturnsTwice (YamlMF.ExposesReturnsTwice );
332
332
333
+ if (YamlMF.NoVRegs )
334
+ MF.getProperties ().set (MachineFunctionProperties::Property::NoVRegs);
333
335
if (YamlMF.Legalized )
334
336
MF.getProperties ().set (MachineFunctionProperties::Property::Legalized);
335
337
if (YamlMF.RegBankSelected )
Original file line number Diff line number Diff line change @@ -175,6 +175,8 @@ void MIRPrinter::print(const MachineFunction &MF) {
175
175
YamlMF.Alignment = MF.getAlignment ();
176
176
YamlMF.ExposesReturnsTwice = MF.exposesReturnsTwice ();
177
177
178
+ YamlMF.NoVRegs = MF.getProperties ().hasProperty (
179
+ MachineFunctionProperties::Property::NoVRegs);
178
180
YamlMF.Legalized = MF.getProperties ().hasProperty (
179
181
MachineFunctionProperties::Property::Legalized);
180
182
YamlMF.RegBankSelected = MF.getProperties ().hasProperty (
Original file line number Diff line number Diff line change @@ -2033,7 +2033,7 @@ bool ARMConstantIslands::optimizeThumb2JumpTables() {
2033
2033
unsigned DeadSize = 0 ;
2034
2034
bool CanDeleteLEA = false ;
2035
2035
bool BaseRegKill = false ;
2036
-
2036
+
2037
2037
unsigned IdxReg = ~0U ;
2038
2038
bool IdxRegKill = true ;
2039
2039
if (isThumb2) {
@@ -2061,6 +2061,12 @@ bool ARMConstantIslands::optimizeThumb2JumpTables() {
2061
2061
IdxReg = Shift->getOperand (2 ).getReg ();
2062
2062
unsigned ShiftedIdxReg = Shift->getOperand (0 ).getReg ();
2063
2063
2064
+ // It's important that IdxReg is live until the actual TBB/TBH. Most of
2065
+ // the range is checked later, but the LEA might still clobber it and not
2066
+ // actually get removed.
2067
+ if (BaseReg == IdxReg && !jumpTableFollowsTB (MI, User.CPEMI ))
2068
+ continue ;
2069
+
2064
2070
MachineInstr *Load = User.MI ->getNextNode ();
2065
2071
if (Load->getOpcode () != ARM::tLDRr)
2066
2072
continue ;
@@ -2086,15 +2092,15 @@ bool ARMConstantIslands::optimizeThumb2JumpTables() {
2086
2092
if (Load->getOperand (0 ).getReg () != MI->getOperand (0 ).getReg ())
2087
2093
continue ;
2088
2094
}
2089
-
2090
-
2095
+
2096
+
2091
2097
// Now safe to delete the load and lsl. The LEA will be removed later.
2092
2098
CanDeleteLEA = true ;
2093
2099
Shift->eraseFromParent ();
2094
2100
Load->eraseFromParent ();
2095
2101
DeadSize += 4 ;
2096
2102
}
2097
-
2103
+
2098
2104
DEBUG (dbgs () << " Shrink JT: " << *MI);
2099
2105
MachineInstr *CPEMI = User.CPEMI ;
2100
2106
unsigned Opc = ByteOk ? ARM::t2TBB_JT : ARM::t2TBH_JT;
You can’t perform that action at this time.
0 commit comments