Subzero: A few fixes toward running larger programs. 1. Add 'llvm2ice -disable-globals' to disable Subzero translation of global initializers, since full support isn't yet implemented. 2. Change the names of intra-block branch target labels to avoid collisions with basic block labels. 3. Fix lowering of "br i1 <constant>, label ...", which was producing invalid instructions like "cmp 1, 0". 4. Fix the "make format-diff" operation, which was diffing against the wrong target. BUG= none R=wala@chromium.org Review URL: https://codereview.chromium.org/449093002
diff --git a/src/IceTargetLoweringX8632.cpp b/src/IceTargetLoweringX8632.cpp index a5704b5..8e56a10 100644 --- a/src/IceTargetLoweringX8632.cpp +++ b/src/IceTargetLoweringX8632.cpp
@@ -1584,7 +1584,7 @@ if (Inst->isUnconditional()) { _br(Inst->getTargetUnconditional()); } else { - Operand *Src0 = legalize(Inst->getCondition()); + Operand *Src0 = legalize(Inst->getCondition(), Legal_Reg | Legal_Mem); Constant *Zero = Ctx->getConstantZero(IceType_i32); _cmp(Src0, Zero); _br(InstX8632Br::Br_ne, Inst->getTargetTrue(), Inst->getTargetFalse()); @@ -2481,8 +2481,8 @@ if (InstBr *NextBr = llvm::dyn_cast_or_null<InstBr>(Context.getNextInst())) { if (Src0->getType() != IceType_i64 && !NextBr->isUnconditional() && Dest == NextBr->getSrc(0) && NextBr->isLastUse(Dest)) { - Operand *Src0New = - legalize(Src0, IsSrc1ImmOrReg ? Legal_All : Legal_Reg, true); + Operand *Src0New = legalize( + Src0, IsSrc1ImmOrReg ? (Legal_Reg | Legal_Mem) : Legal_Reg, true); _cmp(Src0New, Src1); _br(getIcmp32Mapping(Inst->getCondition()), NextBr->getTargetTrue(), NextBr->getTargetFalse());