mirror of
https://github.com/RPCSX/llvm.git
synced 2025-01-24 05:09:34 +00:00
[Reassociate] Use APInt::isNullValue() instead of comparing with 0. NFC
This should compile to slightly better code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305651 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
32639e60f1
commit
4446e996ed
@ -1136,7 +1136,7 @@ static Value *OptimizeAndOrXor(unsigned Opcode,
|
||||
/// be returned.
|
||||
static Value *createAndInstr(Instruction *InsertBefore, Value *Opnd,
|
||||
const APInt &ConstOpnd) {
|
||||
if (ConstOpnd != 0) {
|
||||
if (!ConstOpnd.isNullValue()) {
|
||||
if (!ConstOpnd.isAllOnesValue()) {
|
||||
LLVMContext &Ctx = Opnd->getType()->getContext();
|
||||
Instruction *I;
|
||||
@ -1163,7 +1163,7 @@ bool ReassociatePass::CombineXorOpnd(Instruction *I, XorOpnd *Opnd1,
|
||||
// = ((x | c1) ^ c1) ^ (c1 ^ c2)
|
||||
// = (x & ~c1) ^ (c1 ^ c2)
|
||||
// It is useful only when c1 == c2.
|
||||
if (Opnd1->isOrExpr() && Opnd1->getConstPart() != 0) {
|
||||
if (Opnd1->isOrExpr() && !Opnd1->getConstPart().isNullValue()) {
|
||||
if (!Opnd1->getValue()->hasOneUse())
|
||||
return false;
|
||||
|
||||
@ -1221,8 +1221,8 @@ bool ReassociatePass::CombineXorOpnd(Instruction *I, XorOpnd *Opnd1,
|
||||
APInt C3((~C1) ^ C2);
|
||||
|
||||
// Do not increase code size!
|
||||
if (C3 != 0 && !C3.isAllOnesValue()) {
|
||||
int NewInstNum = ConstOpnd != 0 ? 1 : 2;
|
||||
if (!C3.isNullValue() && !C3.isAllOnesValue()) {
|
||||
int NewInstNum = ConstOpnd.getBoolValue() ? 1 : 2;
|
||||
if (NewInstNum > DeadInstNum)
|
||||
return false;
|
||||
}
|
||||
@ -1238,8 +1238,8 @@ bool ReassociatePass::CombineXorOpnd(Instruction *I, XorOpnd *Opnd1,
|
||||
APInt C3 = C1 ^ C2;
|
||||
|
||||
// Do not increase code size
|
||||
if (C3 != 0 && !C3.isAllOnesValue()) {
|
||||
int NewInstNum = ConstOpnd != 0 ? 1 : 2;
|
||||
if (!C3.isNullValue() && !C3.isAllOnesValue()) {
|
||||
int NewInstNum = ConstOpnd.getBoolValue() ? 1 : 2;
|
||||
if (NewInstNum > DeadInstNum)
|
||||
return false;
|
||||
}
|
||||
@ -1327,7 +1327,8 @@ Value *ReassociatePass::OptimizeXor(Instruction *I,
|
||||
Value *CV;
|
||||
|
||||
// Step 3.1: Try simplifying "CurrOpnd ^ ConstOpnd"
|
||||
if (ConstOpnd != 0 && CombineXorOpnd(I, CurrOpnd, ConstOpnd, CV)) {
|
||||
if (!ConstOpnd.isNullValue() &&
|
||||
CombineXorOpnd(I, CurrOpnd, ConstOpnd, CV)) {
|
||||
Changed = true;
|
||||
if (CV)
|
||||
*CurrOpnd = XorOpnd(CV);
|
||||
@ -1369,7 +1370,7 @@ Value *ReassociatePass::OptimizeXor(Instruction *I,
|
||||
ValueEntry VE(getRank(O.getValue()), O.getValue());
|
||||
Ops.push_back(VE);
|
||||
}
|
||||
if (ConstOpnd != 0) {
|
||||
if (!ConstOpnd.isNullValue()) {
|
||||
Value *C = ConstantInt::get(Ty->getContext(), ConstOpnd);
|
||||
ValueEntry VE(getRank(C), C);
|
||||
Ops.push_back(VE);
|
||||
|
Loading…
x
Reference in New Issue
Block a user