<p dir="ltr">Mind replying to that one and saying what changed?</p>
<p dir="ltr">Thanks!</p>
<div class="gmail_quote">On Jul 16, 2014 3:35 PM, "Juergen Ributzka" <<a href="mailto:juergen@apple.com">juergen@apple.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Sorry about that - I will remember it for next time.<br>
This commit actually never changed, but it was dependent on another commit that was broken.<br>
<br>
Cheers,<br>
Juergen<br>
<br>
On Jul 15, 2014, at 3:57 PM, Eric Christopher <<a href="mailto:echristo@gmail.com">echristo@gmail.com</a>> wrote:<br>
<br>
> So you reapplied these without a comment as to what you<br>
> fixed/changed/anything again.<br>
><br>
> Please remember to comment on the patches with what changed if<br>
> anything and next time please be sure to add in the commit message<br>
> that you're reapplying something that you've reverted with a fix or a<br>
> comment that it didn't break anything so that everyone else knows<br>
> what's going on.<br>
><br>
> Thanks.<br>
><br>
> -eric<br>
><br>
> On Mon, Jul 14, 2014 at 11:35 PM, Juergen Ributzka <<a href="mailto:juergen@apple.com">juergen@apple.com</a>> wrote:<br>
>> Author: ributzka<br>
>> Date: Tue Jul 15 01:35:50 2014<br>
>> New Revision: 213050<br>
>><br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=213050&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=213050&view=rev</a><br>
>> Log:<br>
>> [FastISel][X86] Implement the FastLowerIntrinsicCall hook.<br>
>><br>
>> Rename X86VisitIntrinsicCall -> FastLowerIntrinsicCall, which effectively<br>
>> implements the target hook.<br>
>><br>
>> Modified:<br>
>> llvm/trunk/lib/Target/X86/X86FastISel.cpp<br>
>><br>
>> Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FastISel.cpp?rev=213050&r1=213049&r2=213050&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FastISel.cpp?rev=213050&r1=213049&r2=213050&view=diff</a><br>
>> ==============================================================================<br>
>> --- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original)<br>
>> +++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Tue Jul 15 01:35:50 2014<br>
>> @@ -75,6 +75,7 @@ public:<br>
>><br>
>> bool FastLowerArguments() override;<br>
>> bool FastLowerCall(CallLoweringInfo &CLI) override;<br>
>> + bool FastLowerIntrinsicCall(const IntrinsicInst *II) override;<br>
>><br>
>> #include "X86GenFastISel.inc"<br>
>><br>
>> @@ -125,7 +126,6 @@ private:<br>
>> bool X86SelectFPExt(const Instruction *I);<br>
>> bool X86SelectFPTrunc(const Instruction *I);<br>
>><br>
>> - bool X86VisitIntrinsicCall(const IntrinsicInst &I);<br>
>> bool X86SelectCall(const Instruction *I);<br>
>><br>
>> bool DoSelectCall(const Instruction *I, const char *MemIntName);<br>
>> @@ -2167,8 +2167,8 @@ bool X86FastISel::TryEmitSmallMemcpy(X86<br>
>> return true;<br>
>> }<br>
>><br>
>> -static bool isCommutativeIntrinsic(IntrinsicInst const &I) {<br>
>> - switch (I.getIntrinsicID()) {<br>
>> +static bool isCommutativeIntrinsic(IntrinsicInst const *II) {<br>
>> + switch (II->getIntrinsicID()) {<br>
>> case Intrinsic::sadd_with_overflow:<br>
>> case Intrinsic::uadd_with_overflow:<br>
>> case Intrinsic::smul_with_overflow:<br>
>> @@ -2179,12 +2179,12 @@ static bool isCommutativeIntrinsic(Intri<br>
>> }<br>
>> }<br>
>><br>
>> -bool X86FastISel::X86VisitIntrinsicCall(const IntrinsicInst &I) {<br>
>> +bool X86FastISel::FastLowerIntrinsicCall(const IntrinsicInst *II) {<br>
>> // FIXME: Handle more intrinsics.<br>
>> - switch (I.getIntrinsicID()) {<br>
>> + switch (II->getIntrinsicID()) {<br>
>> default: return false;<br>
>> case Intrinsic::frameaddress: {<br>
>> - Type *RetTy = I.getCalledFunction()->getReturnType();<br>
>> + Type *RetTy = II->getCalledFunction()->getReturnType();<br>
>><br>
>> MVT VT;<br>
>> if (!isTypeLegal(RetTy, VT))<br>
>> @@ -2224,7 +2224,7 @@ bool X86FastISel::X86VisitIntrinsicCall(<br>
>> // movq (%rax), %rax<br>
>> // ...<br>
>> unsigned DestReg;<br>
>> - unsigned Depth = cast<ConstantInt>(I.getOperand(0))->getZExtValue();<br>
>> + unsigned Depth = cast<ConstantInt>(II->getOperand(0))->getZExtValue();<br>
>> while (Depth--) {<br>
>> DestReg = createResultReg(RC);<br>
>> addDirectMem(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc,<br>
>> @@ -2232,23 +2232,23 @@ bool X86FastISel::X86VisitIntrinsicCall(<br>
>> SrcReg = DestReg;<br>
>> }<br>
>><br>
>> - UpdateValueMap(&I, SrcReg);<br>
>> + UpdateValueMap(II, SrcReg);<br>
>> return true;<br>
>> }<br>
>> case Intrinsic::memcpy: {<br>
>> - const MemCpyInst &MCI = cast<MemCpyInst>(I);<br>
>> + const MemCpyInst *MCI = cast<MemCpyInst>(II);<br>
>> // Don't handle volatile or variable length memcpys.<br>
>> - if (MCI.isVolatile())<br>
>> + if (MCI->isVolatile())<br>
>> return false;<br>
>><br>
>> - if (isa<ConstantInt>(MCI.getLength())) {<br>
>> + if (isa<ConstantInt>(MCI->getLength())) {<br>
>> // Small memcpy's are common enough that we want to do them<br>
>> // without a call if possible.<br>
>> - uint64_t Len = cast<ConstantInt>(MCI.getLength())->getZExtValue();<br>
>> + uint64_t Len = cast<ConstantInt>(MCI->getLength())->getZExtValue();<br>
>> if (IsMemcpySmall(Len)) {<br>
>> X86AddressMode DestAM, SrcAM;<br>
>> - if (!X86SelectAddress(MCI.getRawDest(), DestAM) ||<br>
>> - !X86SelectAddress(MCI.getRawSource(), SrcAM))<br>
>> + if (!X86SelectAddress(MCI->getRawDest(), DestAM) ||<br>
>> + !X86SelectAddress(MCI->getRawSource(), SrcAM))<br>
>> return false;<br>
>> TryEmitSmallMemcpy(DestAM, SrcAM, Len);<br>
>> return true;<br>
>> @@ -2256,35 +2256,35 @@ bool X86FastISel::X86VisitIntrinsicCall(<br>
>> }<br>
>><br>
>> unsigned SizeWidth = Subtarget->is64Bit() ? 64 : 32;<br>
>> - if (!MCI.getLength()->getType()->isIntegerTy(SizeWidth))<br>
>> + if (!MCI->getLength()->getType()->isIntegerTy(SizeWidth))<br>
>> return false;<br>
>><br>
>> - if (MCI.getSourceAddressSpace() > 255 || MCI.getDestAddressSpace() > 255)<br>
>> + if (MCI->getSourceAddressSpace() > 255 || MCI->getDestAddressSpace() > 255)<br>
>> return false;<br>
>><br>
>> - return DoSelectCall(&I, "memcpy");<br>
>> + return LowerCallTo(II, "memcpy", II->getNumArgOperands() - 2);<br>
>> }<br>
>> case Intrinsic::memset: {<br>
>> - const MemSetInst &MSI = cast<MemSetInst>(I);<br>
>> + const MemSetInst *MSI = cast<MemSetInst>(II);<br>
>><br>
>> - if (MSI.isVolatile())<br>
>> + if (MSI->isVolatile())<br>
>> return false;<br>
>><br>
>> unsigned SizeWidth = Subtarget->is64Bit() ? 64 : 32;<br>
>> - if (!MSI.getLength()->getType()->isIntegerTy(SizeWidth))<br>
>> + if (!MSI->getLength()->getType()->isIntegerTy(SizeWidth))<br>
>> return false;<br>
>><br>
>> - if (MSI.getDestAddressSpace() > 255)<br>
>> + if (MSI->getDestAddressSpace() > 255)<br>
>> return false;<br>
>><br>
>> - return DoSelectCall(&I, "memset");<br>
>> + return LowerCallTo(II, "memset", II->getNumArgOperands() - 2);<br>
>> }<br>
>> case Intrinsic::stackprotector: {<br>
>> // Emit code to store the stack guard onto the stack.<br>
>> EVT PtrTy = TLI.getPointerTy();<br>
>><br>
>> - const Value *Op1 = I.getArgOperand(0); // The guard's value.<br>
>> - const AllocaInst *Slot = cast<AllocaInst>(I.getArgOperand(1));<br>
>> + const Value *Op1 = II->getArgOperand(0); // The guard's value.<br>
>> + const AllocaInst *Slot = cast<AllocaInst>(II->getArgOperand(1));<br>
>><br>
>> MFI.setStackProtectorIndex(FuncInfo.StaticAllocaMap[Slot]);<br>
>><br>
>> @@ -2295,7 +2295,7 @@ bool X86FastISel::X86VisitIntrinsicCall(<br>
>> return true;<br>
>> }<br>
>> case Intrinsic::dbg_declare: {<br>
>> - const DbgDeclareInst *DI = cast<DbgDeclareInst>(&I);<br>
>> + const DbgDeclareInst *DI = cast<DbgDeclareInst>(II);<br>
>> X86AddressMode AM;<br>
>> assert(DI->getAddress() && "Null address should be checked earlier!");<br>
>> if (!X86SelectAddress(DI->getAddress(), AM))<br>
>> @@ -2315,7 +2315,7 @@ bool X86FastISel::X86VisitIntrinsicCall(<br>
>> if (!Subtarget->hasSSE1())<br>
>> return false;<br>
>><br>
>> - Type *RetTy = I.getCalledFunction()->getReturnType();<br>
>> + Type *RetTy = II->getCalledFunction()->getReturnType();<br>
>><br>
>> MVT VT;<br>
>> if (!isTypeLegal(RetTy, VT))<br>
>> @@ -2337,7 +2337,7 @@ bool X86FastISel::X86VisitIntrinsicCall(<br>
>> case MVT::f64: Opc = SqrtOpc[1][HasAVX]; RC = &X86::FR64RegClass; break;<br>
>> }<br>
>><br>
>> - const Value *SrcVal = I.getArgOperand(0);<br>
>> + const Value *SrcVal = II->getArgOperand(0);<br>
>> unsigned SrcReg = getRegForValue(SrcVal);<br>
>><br>
>> if (SrcReg == 0)<br>
>> @@ -2360,7 +2360,7 @@ bool X86FastISel::X86VisitIntrinsicCall(<br>
>><br>
>> MIB.addReg(SrcReg);<br>
>><br>
>> - UpdateValueMap(&I, ResultReg);<br>
>> + UpdateValueMap(II, ResultReg);<br>
>> return true;<br>
>> }<br>
>> case Intrinsic::sadd_with_overflow:<br>
>> @@ -2371,7 +2371,7 @@ bool X86FastISel::X86VisitIntrinsicCall(<br>
>> case Intrinsic::umul_with_overflow: {<br>
>> // This implements the basic lowering of the xalu with overflow intrinsics<br>
>> // into add/sub/mul followed by either seto or setb.<br>
>> - const Function *Callee = I.getCalledFunction();<br>
>> + const Function *Callee = II->getCalledFunction();<br>
>> auto *Ty = cast<StructType>(Callee->getReturnType());<br>
>> Type *RetTy = Ty->getTypeAtIndex(0U);<br>
>> Type *CondTy = Ty->getTypeAtIndex(1);<br>
>> @@ -2383,16 +2383,16 @@ bool X86FastISel::X86VisitIntrinsicCall(<br>
>> if (VT < MVT::i8 || VT > MVT::i64)<br>
>> return false;<br>
>><br>
>> - const Value *LHS = I.getArgOperand(0);<br>
>> - const Value *RHS = I.getArgOperand(1);<br>
>> + const Value *LHS = II->getArgOperand(0);<br>
>> + const Value *RHS = II->getArgOperand(1);<br>
>><br>
>> // Canonicalize immediate to the RHS.<br>
>> if (isa<ConstantInt>(LHS) && !isa<ConstantInt>(RHS) &&<br>
>> - isCommutativeIntrinsic(I))<br>
>> + isCommutativeIntrinsic(II))<br>
>> std::swap(LHS, RHS);<br>
>><br>
>> unsigned BaseOpc, CondOpc;<br>
>> - switch (I.getIntrinsicID()) {<br>
>> + switch (II->getIntrinsicID()) {<br>
>> default: llvm_unreachable("Unexpected intrinsic!");<br>
>> case Intrinsic::sadd_with_overflow:<br>
>> BaseOpc = ISD::ADD; CondOpc = X86::SETOr; break;<br>
>> @@ -2469,7 +2469,7 @@ bool X86FastISel::X86VisitIntrinsicCall(<br>
>> BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc, TII.get(CondOpc),<br>
>> ResultReg2);<br>
>><br>
>> - UpdateValueMap(&I, ResultReg, 2);<br>
>> + UpdateValueMap(II, ResultReg, 2);<br>
>> return true;<br>
>> }<br>
>> case Intrinsic::x86_sse_cvttss2si:<br>
>> @@ -2477,7 +2477,7 @@ bool X86FastISel::X86VisitIntrinsicCall(<br>
>> case Intrinsic::x86_sse2_cvttsd2si:<br>
>> case Intrinsic::x86_sse2_cvttsd2si64: {<br>
>> bool IsInputDouble;<br>
>> - switch (I.getIntrinsicID()) {<br>
>> + switch (II->getIntrinsicID()) {<br>
>> default: llvm_unreachable("Unexpected intrinsic.");<br>
>> case Intrinsic::x86_sse_cvttss2si:<br>
>> case Intrinsic::x86_sse_cvttss2si64:<br>
>> @@ -2493,7 +2493,7 @@ bool X86FastISel::X86VisitIntrinsicCall(<br>
>> break;<br>
>> }<br>
>><br>
>> - Type *RetTy = I.getCalledFunction()->getReturnType();<br>
>> + Type *RetTy = II->getCalledFunction()->getReturnType();<br>
>> MVT VT;<br>
>> if (!isTypeLegal(RetTy, VT))<br>
>> return false;<br>
>> @@ -2513,7 +2513,7 @@ bool X86FastISel::X86VisitIntrinsicCall(<br>
>> }<br>
>><br>
>> // Check if we can fold insertelement instructions into the convert.<br>
>> - const Value *Op = I.getArgOperand(0);<br>
>> + const Value *Op = II->getArgOperand(0);<br>
>> while (auto *IE = dyn_cast<InsertElementInst>(Op)) {<br>
>> const Value *Index = IE->getOperand(2);<br>
>> if (!isa<ConstantInt>(Index))<br>
>> @@ -2535,7 +2535,7 @@ bool X86FastISel::X86VisitIntrinsicCall(<br>
>> BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc, TII.get(Opc), ResultReg)<br>
>> .addReg(Reg);<br>
>><br>
>> - UpdateValueMap(&I, ResultReg);<br>
>> + UpdateValueMap(II, ResultReg);<br>
>> return true;<br>
>> }<br>
>> }<br>
>> @@ -2644,9 +2644,9 @@ bool X86FastISel::X86SelectCall(const In<br>
>> if (isa<InlineAsm>(Callee))<br>
>> return false;<br>
>><br>
>> - // Handle intrinsic calls.<br>
>> - if (const IntrinsicInst *II = dyn_cast<IntrinsicInst>(CI))<br>
>> - return X86VisitIntrinsicCall(*II);<br>
>> + // Skip intrinsic calls - we already handled these.<br>
>> + if (isa<IntrinsicInst>(CI))<br>
>> + return false;<br>
>><br>
>> // Allow SelectionDAG isel to handle tail calls.<br>
>> if (cast<CallInst>(I)->isTailCall())<br>
>><br>
>><br>
>> _______________________________________________<br>
>> llvm-commits mailing list<br>
>> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br>
</blockquote></div>