[llvm-commits] [llvm] r153465 - /llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp
Duncan Sands
baldrick at free.fr
Tue Mar 27 01:03:18 PDT 2012
Hi Nadav,
> You are absolutely correct. I realized it a second after I made this commit, and I fixed it in r153468.
yeah, I saw your second commit a few seconds after sending this - oops!
Ciao, Duncan.
>
> Thanks,
> Nadav
>
> -----Original Message-----
> From: llvm-commits-bounces at cs.uiuc.edu [mailto:llvm-commits-bounces at cs.uiuc.edu] On Behalf Of Duncan Sands
> Sent: Tuesday, March 27, 2012 09:54
> To: llvm-commits at cs.uiuc.edu
> Subject: Re: [llvm-commits] [llvm] r153465 - /llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp
>
> Hi Nadav,
>
>> PR12357: The pointer was used before it was checked.
>
>> --- llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp
>> (original)
>> +++ llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp Mon
>> +++ Mar 26 15:39:18 2012
>> @@ -915,11 +915,13 @@
>>
>> // Handle gep(bitcast x) and gep(gep x, 0, 0, 0).
>> Value *StrippedPtr = PtrOp->stripPointerCasts();
>> - PointerType *StrippedPtrTy =
>> dyn_cast<PointerType>(StrippedPtr->getType());
>> +
>> // We do not handle pointer-vector geps here
>> if (!StrippedPtr)
>> return 0;
>>
>> + PointerType *StrippedPtrTy =
>> + dyn_cast<PointerType>(StrippedPtr->getType());
>> +
>> if (StrippedPtr != PtrOp&&
>> StrippedPtrTy->getAddressSpace() ==
>> GEP.getPointerAddressSpace()) {
>
> are you sure the mistake wasn't that
>
> if (!StrippedPtr)
> return 0;
>
> should have been
>
> if (!StrippedPtrTy)
> return 0;
>
> ?
>
> After all, StrippedPtr cannot ever be null, so the test is pointless for it.
> However the dynamic cast generating StrippedPtrTy can result in a null value, which is not checked for. Also, if StrippedPtrTy is null then I think that corresponds to exactly the situation of a GEP on a vector of pointers mentioned in the comment on the test.
>
> Ciao, Duncan.
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> ---------------------------------------------------------------------
> Intel Israel (74) Limited
>
> This e-mail and any attachments may contain confidential material for
> the sole use of the intended recipient(s). Any review or distribution
> by others is strictly prohibited. If you are not the intended
> recipient, please contact the sender and delete all copies.
>
More information about the llvm-commits
mailing list