| Index: src/IceTargetLowering.cpp
|
| diff --git a/src/IceTargetLowering.cpp b/src/IceTargetLowering.cpp
|
| index 69207889b7e349b2a10a5561088f6699e1d431a3..eb4a54d4fb7ea915198113554503fa6178ba361b 100644
|
| --- a/src/IceTargetLowering.cpp
|
| +++ b/src/IceTargetLowering.cpp
|
| @@ -246,17 +246,21 @@ void TargetLowering::regAlloc(RegAllocKind Kind) {
|
| LinearScan.scan(RegMask, Ctx->getFlags().shouldRandomizeRegAlloc());
|
| }
|
|
|
| -void TargetLowering::inferTwoAddress() {
|
| - // Find two-address non-SSA instructions where Dest==Src0, and set the
|
| - // DestNonKillable flag to keep liveness analysis consistent.
|
| +void TargetLowering::markRedefinitions() {
|
| + // Find (non-SSA) instructions where the Dest variable appears in some source
|
| + // operand, and set the IsDestRedefined flag to keep liveness analysis
|
| + // consistent.
|
| for (auto Inst = Context.getCur(), E = Context.getNext(); Inst != E; ++Inst) {
|
| if (Inst->isDeleted())
|
| continue;
|
| - if (Variable *Dest = Inst->getDest()) {
|
| - // TODO(stichnot): We may need to consider all source operands, not just
|
| - // the first one, if using 3-address instructions.
|
| - if (Inst->getSrcSize() > 0 && Inst->getSrc(0) == Dest)
|
| - Inst->setDestNonKillable();
|
| + Variable *Dest = Inst->getDest();
|
| + if (Dest == nullptr)
|
| + continue;
|
| + FOREACH_VAR_IN_INST(Var, *Inst) {
|
| + if (Var == Dest) {
|
| + Inst->setDestRedefined();
|
| + break;
|
| + }
|
| }
|
| }
|
| }
|
|
|