Chromium Code Reviews| Index: src/IceTargetLoweringX86BaseImpl.h |
| diff --git a/src/IceTargetLoweringX86BaseImpl.h b/src/IceTargetLoweringX86BaseImpl.h |
| index 8f372196779cc6b3c068655afb1ccd4ff3948165..066bffc08a9da9626d6753302d5783c834cc51aa 100644 |
| --- a/src/IceTargetLoweringX86BaseImpl.h |
| +++ b/src/IceTargetLoweringX86BaseImpl.h |
| @@ -5198,6 +5198,13 @@ template <class Machine> |
| void TargetX86Base<Machine>::lowerUnreachable( |
| const InstUnreachable * /*Inst*/) { |
| _ud2(); |
| + // Add a fake use of esp to make sure esp stays alive for the entire |
|
Jim Stichnoth
2015/11/13 23:30:33
Could you factor this code and its lowerRet clone
sehr
2015/11/14 00:30:56
Done.
|
| + // function. Otherwise post-call esp adjustments get dead-code eliminated. |
| + // TODO: Are there more places where the fake use should be inserted? E.g. |
|
Jim Stichnoth
2015/11/13 23:30:33
Remove this TODO because I'm pretty sure this cove
sehr
2015/11/14 00:30:56
Done.
|
| + // "void f(int n){while(1) g(n);}" may not have an unreachable instruction. |
| + Variable *esp = |
| + Func->getTarget()->getPhysicalRegister(Traits::RegisterSet::Reg_esp); |
|
Jim Stichnoth
2015/11/13 23:30:33
Use getStackReg() instead of Reg_esp.
BTW, getSta
sehr
2015/11/14 00:30:56
Done.
|
| + Context.insert(InstFakeUse::create(Func, esp)); |
| } |
| template <class Machine> |