[PATCH] D31924: SROA: Allow eliminating addrspacecasted allocas
Sanjoy Das via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 20 13:41:37 PDT 2017
sanjoy added inline comments.
================
Comment at: lib/Transforms/Scalar/SROA.cpp:1557
+ unsigned Opc = Operator::getOpcode(Ptr);
+ if (Opc == Instruction::BitCast || Opc == Instruction::AddrSpaceCast) {
Ptr = cast<Operator>(Ptr)->getOperand(0);
----------------
Are you ruling that `GEP(CAST(X), 1)` is the same as `CAST(GEP X, 1)`? If so, I'm not sure this is correct given your constraint on address space casts.
For instance, if casting from address space N to M, with both spaces having the same pointer width, involves flipping the high and low halves of the pointer then `GEP(CAST(X), 1)` is not the same as `(CAST(GEP X, 1))`.
Of course, this means that GEPs over pointers of address space M are different operations from GEPs over pointers of address space N, but that's allowed, AFAIK.
https://reviews.llvm.org/D31924
More information about the llvm-commits
mailing list