PATCH + test for PR17099.

Stepan Dyatkovskiy stpworld at narod.ru
Mon Sep 16 04:12:50 PDT 2013


ping
Stepan Dyatkovskiy wrote:
> Hi!
> Sorry for latency.
>
> OK, then. There are three patches, you guys just select proper one (if
> present) :-)
>
> -Stepan.
>
> Benjamin Kramer wrote:
>>
>> On 07.09.2013, at 09:53, Stepan Dyatkovskiy <stpworld at narod.ru> wrote:
>>
>>> Fixed.
>>> -Stepan.
>>
>> There is a very similar piece of code a few lines below, can this be
>> merged? Also the bit width of the two types should always match, using
>> getCastOpcode is a bit strange here. Maybe it's better to hoist the
>> existing inttoptr/ptrtoint/bitcast code into a helper function and use
>> that.
>>
>> - Ben
>>
>>>
>>> Rafael EspĂ­ndola wrote:
>>>> You can use CHECK-LABEL for the function definitions.
>>>>
>>>> Ctx is unused. With that Ty1 is unused.
>>>>
>>>> On 6 September 2013 10:39, Stepan Dyatkovskiy <stpworld at narod.ru>
>>>> wrote:
>>>>> Ah!! My failure!
>>>>> I have added FileCheck. Note, that I removed some extradata from CHECK
>>>>> directives, so for example I added
>>>>> 'tail call void @f0(i64'
>>>>> instead of tail 'call void @f0(i64 %2)'
>>>>> -Stepan.
>>>>>
>>>>>
>>>>> Rafael EspĂ­ndola wrote:
>>>>>>
>>>>>> ; RUN: opt -S -mergefunc < %s
>>>>>>
>>>>>> Please run FileCheck to show that you get the expected output.
>>>>>>
>>>>>> On 6 September 2013 07:36, Stepan Dyatkovskiy <stpworld at narod.ru>
>>>>>> wrote:
>>>>>>>
>>>>>>> Hi Duncan,
>>>>>>> Thanks for hint!
>>>>>>> New patch is in attachment.
>>>>>>>
>>>>>>> -Stepan.
>>>>>>>
>>>>>>>
>>>>>>> Duncan Sands wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>> Hi Stepan,
>>>>>>>>
>>>>>>>>> Please find patch + regression test for MergeFunctions pass
>>>>>>>>> that fixes
>>>>>>>>> PR17099
>>>>>>>>> issue.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>> --- lib/Transforms/IPO/MergeFunctions.cpp    (revision 189742)
>>>>>>>>> +++ lib/Transforms/IPO/MergeFunctions.cpp    (working copy)
>>>>>>>>> @@ -738,7 +738,15 @@
>>>>>>>>>      FunctionType *FFTy = F->getFunctionType();
>>>>>>>>>      for (Function::arg_iterator AI = NewG->arg_begin(), AE =
>>>>>>>>> NewG->arg_end();
>>>>>>>>>           AI != AE; ++AI) {
>>>>>>>>> -    Args.push_back(Builder.CreateBitCast(AI,
>>>>>>>>> FFTy->getParamType(i)));
>>>>>>>>> +    Type* Ty1 = AI->getType();
>>>>>>>>> +    Type* Ty2 = FFTy->getParamType(i);
>>>>>>>>> +    LLVMContext &Ctx = Ty1->getContext();
>>>>>>>>> +    if (isa<PointerType>(Ty1) && Ty2 == TD->getIntPtrType(Ctx))
>>>>>>>>> +      Args.push_back(Builder.CreatePtrToInt(AI, Ty2));
>>>>>>>>> +    else if (isa<PointerType>(Ty2) && Ty1 ==
>>>>>>>>> TD->getIntPtrType(Ctx))
>>>>>>>>> +      Args.push_back(Builder.CreateIntToPtr(AI, Ty2));
>>>>>>>>> +    else
>>>>>>>>> +      Args.push_back(Builder.CreateBitCast(AI, Ty2));
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> you can use CastInst::getCastOpcode, which will produce BitCast,
>>>>>>>> IntToPtr or
>>>>>>>> PtrToInt as appropriate.
>>>>>>>>
>>>>>>>> Ciao, Duncan.
>>>>>>>>
>>>>>>>>>        ++i;
>>>>>>>>>      }
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> llvm-commits mailing list
>>>>>>>> llvm-commits at cs.uiuc.edu
>>>>>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>
>>>
>>> <pr17099-2013-09-07.patch>_______________________________________________
>>>
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>




More information about the llvm-commits mailing list