[InstCombine] add helper functions for foldICmpWithConstant; NFCI

Besides breaking up a 700 line function to improve readability,
this sinks the 'FIXME: ConstantInt' check into each helper. So 
now we can independently break that restriction within any of the
helper functions.

As much as possible, the code was only {cut/paste/clang-format}'ed 
to minimize risk (no functional changes intended), so several more
readability improvements are still possible. 

llvm-svn: 278828
This commit is contained in:
Sanjay Patel 2016-08-16 17:54:36 +00:00
parent 5cd57177a5
commit a3f4f0828b
2 changed files with 790 additions and 653 deletions

File diff suppressed because it is too large Load Diff

View File

@ -548,10 +548,10 @@ private:
ConstantInt *AndCst = nullptr);
Instruction *foldFCmpIntToFPConst(FCmpInst &I, Instruction *LHSI,
Constant *RHSC);
Instruction *foldICmpDivConst(ICmpInst &ICI, BinaryOperator *DivI,
ConstantInt *DivRHS);
Instruction *foldICmpShrConst(ICmpInst &ICI, BinaryOperator *DivI,
ConstantInt *DivRHS);
Instruction *foldICmpDivConstConst(ICmpInst &ICI, BinaryOperator *DivI,
ConstantInt *DivRHS);
Instruction *foldICmpShrConstConst(ICmpInst &ICI, BinaryOperator *DivI,
ConstantInt *DivRHS);
Instruction *foldICmpCstShrConst(ICmpInst &I, Value *Op, Value *A,
ConstantInt *CI1, ConstantInt *CI2);
Instruction *foldICmpCstShlConst(ICmpInst &I, Value *Op, Value *A,
@ -560,6 +560,30 @@ private:
ICmpInst::Predicate Pred);
Instruction *foldICmpWithCastAndCast(ICmpInst &ICI);
Instruction *foldICmpWithConstant(ICmpInst &ICI);
Instruction *foldICmpTruncConstant(ICmpInst &ICI, Instruction *LHSI,
const APInt *RHSV);
Instruction *foldICmpAndConstant(ICmpInst &ICI, Instruction *LHSI,
const APInt *RHSV);
Instruction *foldICmpXorConstant(ICmpInst &ICI, Instruction *LHSI,
const APInt *RHSV);
Instruction *foldICmpOrConstant(ICmpInst &ICI, Instruction *LHSI,
const APInt *RHSV);
Instruction *foldICmpMulConstant(ICmpInst &ICI, Instruction *LHSI,
const APInt *RHSV);
Instruction *foldICmpShlConstant(ICmpInst &ICI, Instruction *LHSI,
const APInt *RHSV);
Instruction *foldICmpShrConstant(ICmpInst &ICI, Instruction *LHSI,
const APInt *RHSV);
Instruction *foldICmpUDivConstant(ICmpInst &ICI, Instruction *LHSI,
const APInt *RHSV);
Instruction *foldICmpDivConstant(ICmpInst &ICI, Instruction *LHSI,
const APInt *RHSV);
Instruction *foldICmpSubConstant(ICmpInst &ICI, Instruction *LHSI,
const APInt *RHSV);
Instruction *foldICmpAddConstant(ICmpInst &ICI, Instruction *LHSI,
const APInt *RHSV);
Instruction *foldICmpEqualityWithConstant(ICmpInst &ICI);
Instruction *foldICmpIntrinsicWithConstant(ICmpInst &ICI);