reapply r101434

with a fix for self-hosting

rotate CallInst operands, i.e. move callee to the back
of the operand array

the motivation for this patch are laid out in my mail to llvm-commits:
more efficient access to operands and callee, faster callgraph-construction,
smaller compiler binary


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101465 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Gabor Greif
2010-04-16 15:33:14 +00:00
parent 52d55bd224
commit 4ec2258ffb
44 changed files with 579 additions and 588 deletions

View File

@@ -711,7 +711,7 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) {
}
Instruction *InstCombiner::visitFree(Instruction &FI) {
Value *Op = FI.getOperand(1);
Value *Op = FI.getOperand(0);
// free undef -> unreachable.
if (isa<UndefValue>(Op)) {
@@ -896,7 +896,7 @@ Instruction *InstCombiner::visitExtractValueInst(ExtractValueInst &EV) {
if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(Agg)) {
// We're extracting from an intrinsic, see if we're the only user, which
// allows us to simplify multiple result intrinsics to simpler things that
// just get one value..
// just get one value.
if (II->hasOneUse()) {
// Check if we're grabbing the overflow bit or the result of a 'with
// overflow' intrinsic. If it's the latter we can remove the intrinsic
@@ -905,7 +905,7 @@ Instruction *InstCombiner::visitExtractValueInst(ExtractValueInst &EV) {
case Intrinsic::uadd_with_overflow:
case Intrinsic::sadd_with_overflow:
if (*EV.idx_begin() == 0) { // Normal result.
Value *LHS = II->getOperand(1), *RHS = II->getOperand(2);
Value *LHS = II->getOperand(0), *RHS = II->getOperand(1);
II->replaceAllUsesWith(UndefValue::get(II->getType()));
EraseInstFromFunction(*II);
return BinaryOperator::CreateAdd(LHS, RHS);
@@ -914,7 +914,7 @@ Instruction *InstCombiner::visitExtractValueInst(ExtractValueInst &EV) {
case Intrinsic::usub_with_overflow:
case Intrinsic::ssub_with_overflow:
if (*EV.idx_begin() == 0) { // Normal result.
Value *LHS = II->getOperand(1), *RHS = II->getOperand(2);
Value *LHS = II->getOperand(0), *RHS = II->getOperand(1);
II->replaceAllUsesWith(UndefValue::get(II->getType()));
EraseInstFromFunction(*II);
return BinaryOperator::CreateSub(LHS, RHS);
@@ -923,7 +923,7 @@ Instruction *InstCombiner::visitExtractValueInst(ExtractValueInst &EV) {
case Intrinsic::umul_with_overflow:
case Intrinsic::smul_with_overflow:
if (*EV.idx_begin() == 0) { // Normal result.
Value *LHS = II->getOperand(1), *RHS = II->getOperand(2);
Value *LHS = II->getOperand(0), *RHS = II->getOperand(1);
II->replaceAllUsesWith(UndefValue::get(II->getType()));
EraseInstFromFunction(*II);
return BinaryOperator::CreateMul(LHS, RHS);