From: Gabor Greif Date: Fri, 25 Jun 2010 07:57:14 +0000 (+0000) Subject: use ArgOperand API (some hunks I could split) X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=9c68a7bb45ebf71cec5ab4eab7c73aacdfce16df;p=oota-llvm.git use ArgOperand API (some hunks I could split) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106824 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/InstCombine/InstCombineCalls.cpp b/lib/Transforms/InstCombine/InstCombineCalls.cpp index bd48843235d..9e59f74fed0 100644 --- a/lib/Transforms/InstCombine/InstCombineCalls.cpp +++ b/lib/Transforms/InstCombine/InstCombineCalls.cpp @@ -189,8 +189,8 @@ Instruction *InstCombiner::SimplifyMemTransfer(MemIntrinsic *MI) { SrcAlign = std::max(SrcAlign, CopyAlign); DstAlign = std::max(DstAlign, CopyAlign); - Value *Src = Builder->CreateBitCast(MI->getOperand(2), NewSrcPtrTy); - Value *Dest = Builder->CreateBitCast(MI->getOperand(1), NewDstPtrTy); + Value *Src = Builder->CreateBitCast(MI->getArgOperand(1), NewSrcPtrTy); + Value *Dest = Builder->CreateBitCast(MI->getArgOperand(0), NewDstPtrTy); Instruction *L = new LoadInst(Src, "tmp", MI->isVolatile(), SrcAlign); InsertNewInstBefore(L, *MI); InsertNewInstBefore(new StoreInst(L, Dest, MI->isVolatile(), DstAlign), @@ -522,10 +522,10 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) { } // X + undef -> undef - if (isa(II->getOperand(2))) + if (isa(II->getArgOperand(1))) return ReplaceInstUsesWith(CI, UndefValue::get(II->getType())); - if (ConstantInt *RHS = dyn_cast(II->getOperand(2))) { + if (ConstantInt *RHS = dyn_cast(II->getArgOperand(1))) { // X + 0 -> {X, false} if (RHS->isZero()) { Constant *V[] = { @@ -541,19 +541,19 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) { case Intrinsic::ssub_with_overflow: // undef - X -> undef // X - undef -> undef - if (isa(II->getOperand(1)) || - isa(II->getOperand(2))) + if (isa(II->getArgOperand(0)) || + isa(II->getArgOperand(1))) return ReplaceInstUsesWith(CI, UndefValue::get(II->getType())); - if (ConstantInt *RHS = dyn_cast(II->getOperand(2))) { + if (ConstantInt *RHS = dyn_cast(II->getArgOperand(1))) { // X - 0 -> {X, false} if (RHS->isZero()) { Constant *V[] = { - UndefValue::get(II->getOperand(1)->getType()), + UndefValue::get(II->getArgOperand(0)->getType()), ConstantInt::getFalse(II->getContext()) }; Constant *Struct = ConstantStruct::get(II->getContext(), V, 2, false); - return InsertValueInst::Create(Struct, II->getOperand(1), 0); + return InsertValueInst::Create(Struct, II->getArgOperand(0), 0); } } break; @@ -569,10 +569,10 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) { } // X * undef -> undef - if (isa(II->getOperand(2))) + if (isa(II->getArgOperand(1))) return ReplaceInstUsesWith(CI, UndefValue::get(II->getType())); - if (ConstantInt *RHSI = dyn_cast(II->getOperand(2))) { + if (ConstantInt *RHSI = dyn_cast(II->getArgOperand(1))) { // X*0 -> {0, false} if (RHSI->isZero()) return ReplaceInstUsesWith(CI, Constant::getNullValue(II->getType())); @@ -627,10 +627,10 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) { // These intrinsics only demands the 0th element of its input vector. If // we can simplify the input based on that, do so now. unsigned VWidth = - cast(II->getOperand(1)->getType())->getNumElements(); + cast(II->getArgOperand(0)->getType())->getNumElements(); APInt DemandedElts(VWidth, 1); APInt UndefElts(VWidth, 0); - if (Value *V = SimplifyDemandedVectorElts(II->getOperand(1), DemandedElts, + if (Value *V = SimplifyDemandedVectorElts(II->getArgOperand(0), DemandedElts, UndefElts)) { II->setOperand(1, V); return II; diff --git a/lib/Transforms/Utils/AddrModeMatcher.cpp b/lib/Transforms/Utils/AddrModeMatcher.cpp index ea9d1c1b146..f0cc6f7c5db 100644 --- a/lib/Transforms/Utils/AddrModeMatcher.cpp +++ b/lib/Transforms/Utils/AddrModeMatcher.cpp @@ -450,7 +450,7 @@ static bool FindAllMemoryUses(Instruction *I, if (CallInst *CI = dyn_cast(U)) { InlineAsm *IA = dyn_cast(CI->getCalledValue()); - if (IA == 0) return true; + if (!IA) return true; // If this is a memory operand, we're cool, otherwise bail out. if (!IsOperandAMemoryOperand(CI, IA, I, TLI))