llvm.org GIT mirror llvm / 60c7df2
Fix PR5024. LiveVariables::FindLastPartialDef should return a set of sub-registers that were defined by the last partial def, not just a single sub-register. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82535 91177308-0d34-0410-b5e6-96231b3b80d8 Evan Cheng 10 years ago
2 changed file(s) with 36 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
179179 }
180180
181181 /// FindLastPartialDef - Return the last partial def of the specified register.
182 /// Also returns the sub-register that's defined.
182 /// Also returns the sub-registers that're defined by the instruction.
183183 MachineInstr *LiveVariables::FindLastPartialDef(unsigned Reg,
184 unsigned &PartDefReg) {
184 SmallSet &PartDefRegs) {
185185 unsigned LastDefReg = 0;
186186 unsigned LastDefDist = 0;
187187 MachineInstr *LastDef = NULL;
197197 LastDefDist = Dist;
198198 }
199199 }
200 PartDefReg = LastDefReg;
200
201 if (!LastDef)
202 return 0;
203
204 PartDefRegs.insert(LastDefReg);
205 for (unsigned i = 0, e = LastDef->getNumOperands(); i != e; ++i) {
206 MachineOperand &MO = LastDef->getOperand(i);
207 if (!MO.isReg() || !MO.isDef() || MO.getReg() == 0)
208 continue;
209 unsigned DefReg = MO.getReg();
210 if (TRI->isSubRegister(Reg, DefReg)) {
211 PartDefRegs.insert(DefReg);
212 for (const unsigned *SubRegs = TRI->getSubRegisters(DefReg);
213 unsigned SubReg = *SubRegs; ++SubRegs)
214 PartDefRegs.insert(SubReg);
215 }
216 }
201217 return LastDef;
202218 }
203219
215231 // ...
216232 // = EAX
217233 // All of the sub-registers must have been defined before the use of Reg!
218 unsigned PartDefReg = 0;
219 MachineInstr *LastPartialDef = FindLastPartialDef(Reg, PartDefReg);
234 SmallSet PartDefRegs;
235 MachineInstr *LastPartialDef = FindLastPartialDef(Reg, PartDefRegs);
220236 // If LastPartialDef is NULL, it must be using a livein register.
221237 if (LastPartialDef) {
222238 LastPartialDef->addOperand(MachineOperand::CreateReg(Reg, true/*IsDef*/,
227243 unsigned SubReg = *SubRegs; ++SubRegs) {
228244 if (Processed.count(SubReg))
229245 continue;
230 if (SubReg == PartDefReg || TRI->isSubRegister(PartDefReg, SubReg))
246 if (PartDefRegs.count(SubReg))
231247 continue;
232248 // This part of Reg was defined before the last partial def. It's killed
233249 // here.
0 ; RUN: llc < %s -mtriple=armv7-none-linux-gnueabi -mattr=+neon
1
2 ; PR5024
3
4 %bar = type { <4 x float> }
5 %foo = type { %bar, %bar, %bar, %bar }
6
7 declare arm_aapcs_vfpcc <4 x float> @bbb(%bar*) nounwind
8
9 define arm_aapcs_vfpcc void @aaa(%foo* noalias sret %agg.result, %foo* %tfrm) nounwind {
10 entry:
11 %0 = call arm_aapcs_vfpcc <4 x float> @bbb(%bar* undef) nounwind ; <<4 x float>> [#uses=0]
12 ret void
13 }