llvm.org GIT mirror llvm / 61d2906
Merge 99032 from mainline. If call result is in ST0 and it is not being passed to the caller's caller, then it is not safe to optimize the call into a sibcall since the call result has to be popped off the x87 stack. git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_27@99293 91177308-0d34-0410-b5e6-96231b3b80d8 Tanya Lattner 10 years ago
1 changed file(s) with 22 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
23252325 // return semantics.
23262326 if (isCalleeStructRet || isCallerStructRet)
23272327 return false;
2328
2329 // If the call result is in ST0 / ST1, it needs to be popped off the x87 stack.
2330 // Therefore if it's not used by the call it is not safe to optimize this into
2331 // a sibcall.
2332 bool Unused = false;
2333 for (unsigned i = 0, e = Ins.size(); i != e; ++i) {
2334 if (!Ins[i].Used) {
2335 Unused = true;
2336 break;
2337 }
2338 }
2339 if (Unused) {
2340 SmallVector RVLocs;
2341 CCState CCInfo(CalleeCC, false, getTargetMachine(),
2342 RVLocs, *DAG.getContext());
2343 CCInfo.AnalyzeCallResult(Ins, RetCC_X86);
2344 for (unsigned i = 0; i != RVLocs.size(); ++i) {
2345 CCValAssign &VA = RVLocs[i];
2346 if (VA.getLocReg() == X86::ST0 || VA.getLocReg() == X86::ST1)
2347 return false;
2348 }
2349 }
23282350
23292351 // If the callee takes no arguments then go on to check the results of the
23302352 // call.