Details
- Reviewers
arsenm
Diff Detail
Event Timeline
I'm kind of surprised this was broken. It would probably be better to come up with a testcase where this breaks in a more fundamental pass like instcombine
include/llvm/IR/Instructions.h | ||
---|---|---|
890 ↗ | (On Diff #13128) | This one looks correct already, and this change should be unnecessary. getPointerAddressSpace() already calls getScalarType() |
include/llvm/IR/Operator.h | ||
405–406 | This is a correct fix, but this should use Ty->getPointerAddressSpace() like everywhere else |
Updated the patch to use getPointerAddressSpace(), couldn't find a different
pass that triggers the bug though, so the test still uses mergefunc
LGTM. I would expect you could trigger this by running instcombine with a GEP that ends up getting some kind of constant folding
Had another look, still couldn't find anything. The code is either using GetElementPtrInst instead of GEPOperator, calls getType()->getPointerAddressSpace() or checks for vector types beforehand, so it doesn't trigger the bug. Alias analysis seemed like it could work, but I didn't manage to get a testcase with that either (and I'm too clueless about that code).
Anyway, could someone please land this for me? I don't have commit access. Thanks!
This is a correct fix, but this should use Ty->getPointerAddressSpace() like everywhere else