[PATCH] D48323: Derive GEP index type from Data Layout (cont)
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 20 00:01:14 PDT 2018
lebedev.ri added reviewers: spatel, craig.topper.
lebedev.ri added inline comments.
================
Comment at: lib/Transforms/InstCombine/InstCombineCasts.cpp:1735
Value *P = Builder.CreateZExtOrTrunc(CI.getOperand(0), Ty);
return new IntToPtrInst(P, CI.getType());
----------------
delena wrote:
> lebedev.ri wrote:
> > I realize that it is existing behaviour, but this creates new extra instruction,
> > and does not check for uses of previous instruction.
> > This is not good for instcombine, although i suppose this is a very special case.
> >
> > You //might// want to check that there are tests that verify this behavior, or add such tests.
> It shouldn't create an extra instruction. I fixed incompatibility between IntPtrType and expected type of the source.
> The current version just entered to an endless loop, because the IntPtrType is the index type and not the pointer type.
Hm.
`@test1` had just `ptrtoint`, and ended up with `ptrtoint`+`and`+`icmp`
`@test2` had just `inttoptr`, and ended up with `trunc`+`inttoptr`
That to me looks like new instructions.
But like i said, i suspect this is a very special edge-case.
Repository:
rL LLVM
https://reviews.llvm.org/D48323
More information about the llvm-commits
mailing list