diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2018-08-02 17:32:43 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2018-08-02 17:32:43 +0000 | 
| commit | b7eb8e35e481a74962664b63dfb09483b200209a (patch) | |
| tree | 1937fb4a348458ce2d02ade03ac3bb0aa18d2fcd /lib/Transforms/Scalar/Reassociate.cpp | |
| parent | eb11fae6d08f479c0799db45860a98af528fa6e7 (diff) | |
Notes
Diffstat (limited to 'lib/Transforms/Scalar/Reassociate.cpp')
| -rw-r--r-- | lib/Transforms/Scalar/Reassociate.cpp | 16 | 
1 files changed, 8 insertions, 8 deletions
| diff --git a/lib/Transforms/Scalar/Reassociate.cpp b/lib/Transforms/Scalar/Reassociate.cpp index c81ac70d99e6..1df0a9c49fb1 100644 --- a/lib/Transforms/Scalar/Reassociate.cpp +++ b/lib/Transforms/Scalar/Reassociate.cpp @@ -1179,7 +1179,7 @@ static Value *createAndInstr(Instruction *InsertBefore, Value *Opnd,  // and both "Res" and "ConstOpnd" remain unchanged.  bool ReassociatePass::CombineXorOpnd(Instruction *I, XorOpnd *Opnd1,                                       APInt &ConstOpnd, Value *&Res) { -  // Xor-Rule 1: (x | c1) ^ c2 = (x | c1) ^ (c1 ^ c1) ^ c2  +  // Xor-Rule 1: (x | c1) ^ c2 = (x | c1) ^ (c1 ^ c1) ^ c2    //                       = ((x | c1) ^ c1) ^ (c1 ^ c2)    //                       = (x & ~c1) ^ (c1 ^ c2)    // It is useful only when c1 == c2. @@ -1202,12 +1202,12 @@ bool ReassociatePass::CombineXorOpnd(Instruction *I, XorOpnd *Opnd1,      RedoInsts.insert(T);    return true;  } -                            +  // Helper function of OptimizeXor(). It tries to simplify  // "Opnd1 ^ Opnd2 ^ ConstOpnd" into "R ^ C", where C would be 0, and R is a -// symbolic value.  -//  -// If it was successful, true is returned, and the "R" and "C" is returned  +// symbolic value. +// +// If it was successful, true is returned, and the "R" and "C" is returned  // via "Res" and "ConstOpnd", respectively (If the entire expression is  // evaluated to a constant, the Res is set to NULL); otherwise, false is  // returned, and both "Res" and "ConstOpnd" remain unchanged. @@ -1254,7 +1254,7 @@ bool ReassociatePass::CombineXorOpnd(Instruction *I, XorOpnd *Opnd1,      const APInt &C1 = Opnd1->getConstPart();      const APInt &C2 = Opnd2->getConstPart();      APInt C3 = C1 ^ C2; -     +      // Do not increase code size      if (!C3.isNullValue() && !C3.isAllOnesValue()) {        int NewInstNum = ConstOpnd.getBoolValue() ? 1 : 2; @@ -1290,7 +1290,7 @@ Value *ReassociatePass::OptimizeXor(Instruction *I,                                      SmallVectorImpl<ValueEntry> &Ops) {    if (Value *V = OptimizeAndOrXor(Instruction::Xor, Ops))      return V; -       +    if (Ops.size() == 1)      return nullptr; @@ -1365,7 +1365,7 @@ Value *ReassociatePass::OptimizeXor(Instruction *I,      }      // step 3.2: When previous and current operands share the same symbolic -    //  value, try to simplify "PrevOpnd ^ CurrOpnd ^ ConstOpnd"  +    //  value, try to simplify "PrevOpnd ^ CurrOpnd ^ ConstOpnd"      if (CombineXorOpnd(I, CurrOpnd, PrevOpnd, ConstOpnd, CV)) {        // Remove previous operand        PrevOpnd->Invalidate(); | 
