Use GlobalContext::getConstantZero() to get zero valued constants.
BUG=none
R=stichnot@chromium.org
Review URL: https://codereview.chromium.org/344613002
diff --git a/src/IceTargetLoweringX8632.cpp b/src/IceTargetLoweringX8632.cpp
index 6a09276..3657883 100644
--- a/src/IceTargetLoweringX8632.cpp
+++ b/src/IceTargetLoweringX8632.cpp
@@ -940,7 +940,7 @@
// a.hi = t3
Variable *T_1 = NULL, *T_2 = NULL, *T_3 = NULL;
Constant *BitTest = Ctx->getConstantInt(IceType_i32, 0x20);
- Constant *Zero = Ctx->getConstantInt(IceType_i32, 0);
+ Constant *Zero = Ctx->getConstantZero(IceType_i32);
InstX8632Label *Label = InstX8632Label::create(Func, this);
_mov(T_1, Src1Lo, Reg_ecx);
_mov(T_2, Src0Lo);
@@ -976,7 +976,7 @@
// a.hi = t3
Variable *T_1 = NULL, *T_2 = NULL, *T_3 = NULL;
Constant *BitTest = Ctx->getConstantInt(IceType_i32, 0x20);
- Constant *Zero = Ctx->getConstantInt(IceType_i32, 0);
+ Constant *Zero = Ctx->getConstantZero(IceType_i32);
InstX8632Label *Label = InstX8632Label::create(Func, this);
_mov(T_1, Src1Lo, Reg_ecx);
_mov(T_2, Src0Lo);
@@ -1141,13 +1141,13 @@
Src1 = legalize(Src1, Legal_Reg | Legal_Mem);
if (Dest->getType() == IceType_i8) {
Variable *T_ah = NULL;
- Constant *Zero = Ctx->getConstantInt(IceType_i8, 0);
+ Constant *Zero = Ctx->getConstantZero(IceType_i8);
_mov(T, Src0, Reg_eax);
_mov(T_ah, Zero, Reg_ah);
_div(T, Src1, T_ah);
_mov(Dest, T);
} else {
- Constant *Zero = Ctx->getConstantInt(IceType_i32, 0);
+ Constant *Zero = Ctx->getConstantZero(IceType_i32);
_mov(T, Src0, Reg_eax);
_mov(T_edx, Zero, Reg_edx);
_div(T, Src1, T_edx);
@@ -1166,13 +1166,13 @@
Src1 = legalize(Src1, Legal_Reg | Legal_Mem);
if (Dest->getType() == IceType_i8) {
Variable *T_ah = NULL;
- Constant *Zero = Ctx->getConstantInt(IceType_i8, 0);
+ Constant *Zero = Ctx->getConstantZero(IceType_i8);
_mov(T, Src0, Reg_eax);
_mov(T_ah, Zero, Reg_ah);
_div(T_ah, Src1, T);
_mov(Dest, T_ah);
} else {
- Constant *Zero = Ctx->getConstantInt(IceType_i32, 0);
+ Constant *Zero = Ctx->getConstantZero(IceType_i32);
_mov(T_edx, Zero, Reg_edx);
_mov(T, Src0, Reg_eax);
_div(T_edx, Src1, T);
@@ -1248,7 +1248,7 @@
_br(Inst->getTargetUnconditional());
} else {
Operand *Src0 = legalize(Inst->getCondition());
- Constant *Zero = Ctx->getConstantInt(IceType_i32, 0);
+ Constant *Zero = Ctx->getConstantZero(IceType_i32);
_cmp(Src0, Zero);
_br(InstX8632Br::Br_ne, Inst->getTargetTrue(), Inst->getTargetFalse());
}
@@ -1411,7 +1411,7 @@
case InstCast::Zext:
if (Dest->getType() == IceType_i64) {
// t1=movzx src; dst.lo=t1; dst.hi=0
- Constant *Zero = Ctx->getConstantInt(IceType_i32, 0);
+ Constant *Zero = Ctx->getConstantZero(IceType_i32);
Variable *DestLo = llvm::cast<Variable>(loOperand(Dest));
Variable *DestHi = llvm::cast<Variable>(hiOperand(Dest));
Variable *Tmp = makeReg(DestLo->getType());
@@ -1727,7 +1727,7 @@
}
// a=icmp cond, b, c ==> cmp b,c; a=1; br cond,L1; FakeUse(a); a=0; L1:
- Constant *Zero = Ctx->getConstantInt(IceType_i32, 0);
+ Constant *Zero = Ctx->getConstantZero(IceType_i32);
Constant *One = Ctx->getConstantInt(IceType_i32, 1);
if (Src0->getType() == IceType_i64) {
InstIcmp::ICond Condition = Inst->getCondition();
@@ -2014,7 +2014,7 @@
Operand *SrcT = Inst->getTrueOperand();
Operand *SrcF = Inst->getFalseOperand();
Operand *Condition = legalize(Inst->getCondition());
- Constant *Zero = Ctx->getConstantInt(IceType_i32, 0);
+ Constant *Zero = Ctx->getConstantZero(IceType_i32);
InstX8632Label *Label = InstX8632Label::create(Func, this);
if (Dest->getType() == IceType_i64) {