[llvm] r243167 - Remove unnecessary null check. NFC.
Pete Cooper
peter_cooper at apple.com
Mon Jul 27 11:39:08 PDT 2015
> On Jul 27, 2015, at 11:34 AM, Duncan P. N. Exon Smith <dexonsmith at apple.com> wrote:
>
>
>> On 2015-Jul-24, at 14:38, Pete Cooper <peter_cooper at apple.com> wrote:
>>
>> Author: pete
>> Date: Fri Jul 24 16:38:01 2015
>> New Revision: 243167
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=243167&view=rev
>> Log:
>> Remove unnecessary null check. NFC.
>>
>> Since both places which set this variable do so with dyn_cast, and not
>> dyn_cast_or_null, its impossible to get a nullptr here, so we can remove
>> the check.
>>
>
> But `dyn_cast` will return null if the cast fails. If you're sure
> the cast won't fail, you should just use `cast`.
Ah, you’re totally right. My brain clearly wasn’t thinking properly when i looked at this. I got dyn_cast_or_null confused with dyn_cast.
Reverted in r243302.
Cheers,
Pete
>
>> Modified:
>> llvm/trunk/lib/Transforms/Scalar/LoopInterchange.cpp
>>
>> Modified: llvm/trunk/lib/Transforms/Scalar/LoopInterchange.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopInterchange.cpp?rev=243167&r1=243166&r2=243167&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/Transforms/Scalar/LoopInterchange.cpp (original)
>> +++ llvm/trunk/lib/Transforms/Scalar/LoopInterchange.cpp Fri Jul 24 16:38:01 2015
>> @@ -817,9 +817,6 @@ bool LoopInterchangeLegality::currentLim
>> InnerIndexVarInc =
>> dyn_cast<Instruction>(InnerInductionVar->getIncomingValue(0));
>>
>> - if (!InnerIndexVarInc)
>> - return true;
>> -
>> // Since we split the inner loop latch on this induction variable. Make sure
>> // we do not have any instruction between the induction variable and branch
>> // instruction.
>>
>>
>> _______________________________________________
>> 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