[llvm-commits] [llvm] r166578 - in /llvm/trunk: include/llvm/ include/llvm/Analysis/ include/llvm/Transforms/Utils/ lib/Analysis/ lib/CodeGen/ lib/CodeGen/AsmPrinter/ lib/CodeGen/SelectionDAG/ lib/Target/ lib/Target/ARM/ lib/Target/NVPTX/ lib/Tar

Nick Lewycky nlewycky at google.com
Wed Oct 31 18:13:12 PDT 2012


On 24 October 2012 08:52, Micah Villmow <villmow at gmail.com> wrote:

> Author: mvillmow
> Date: Wed Oct 24 10:52:52 2012
> New Revision: 166578
>
> URL: http://llvm.org/viewvc/llvm-project?rev=166578&view=rev
> Log:
> Add in support for getIntPtrType to get the pointer type based on the
> address space.
> This checkin also adds in some tests that utilize these paths and updates
> some of the
> clients.
>
>
[...]


>        // Only do this transformation if the int is intptrty in size,
> otherwise
>        // there is a truncation or extension that we aren't modeling.
> -      if (CE0->getOpcode() == Instruction::PtrToInt &&
> -          CE0->getType() == IntPtrTy) {
> -        Constant *C = CE0->getOperand(0);
> -        Constant *Null = Constant::getNullValue(C->getType());
> -        return ConstantFoldCompareInstOperands(Predicate, C, Null, TD,
> TLI);
> +      if (CE0->getOpcode() == Instruction::PtrToInt) {
> +        IntPtrTy = TD->getIntPtrType(CE0->getOperand(0)->getType());
>

What about when TD is null? See PR14233 for a crash caused by this, but
while that could be fixed by passing the TD down don't forget that people
can have modules with no TD at all.


> +        if (CE0->getType() == IntPtrTy) {
> +          Constant *C = CE0->getOperand(0);
> +          Constant *Null = Constant::getNullValue(C->getType());
> +          return ConstantFoldCompareInstOperands(Predicate, C, Null, TD,
> TLI);
> +        }
>        }
>      }
> -
>

Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121031/e9f9efce/attachment.html>


More information about the llvm-commits mailing list