Skip to content

Commit 1d1e3d3

Browse files
author
chengjunp
committed
Do not handle ptr cases
1 parent 8f69c55 commit 1d1e3d3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

llvm/lib/Transforms/Scalar/SROA.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2980,6 +2980,10 @@ class AllocaSliceRewriter : public InstVisitor<AllocaSliceRewriter, bool> {
29802980
AllocatedEltTy = FixedVecTy->getElementType();
29812981
else
29822982
return std::nullopt;
2983+
// If the allocated element type is a pointer, we do not handle it
2984+
// TODO: handle this case by using inttoptr/ptrtoint
2985+
if (AllocatedEltTy->isPtrOrPtrVectorTy())
2986+
return std::nullopt;
29832987

29842988
for (Slice &S : P) {
29852989
auto *User = cast<Instruction>(S.getUse()->getUser());
@@ -2997,6 +3001,10 @@ class AllocaSliceRewriter : public InstVisitor<AllocaSliceRewriter, bool> {
29973001
if (DL.getTypeSizeInBits(FixedVecTy) !=
29983002
DL.getTypeSizeInBits(NewAI.getAllocatedType()))
29993003
return std::nullopt;
3004+
// If the loaded value is a pointer, we do not handle it
3005+
// TODO: handle this case by using inttoptr/ptrtoint
3006+
if (FixedVecTy->getElementType()->isPtrOrPtrVectorTy())
3007+
return std::nullopt;
30003008
TheLoad = LI;
30013009
} else if (auto *SI = dyn_cast<StoreInst>(User)) {
30023010
// The stored value should be a fixed vector type
@@ -3009,6 +3017,10 @@ class AllocaSliceRewriter : public InstVisitor<AllocaSliceRewriter, bool> {
30093017
if (DL.getTypeSizeInBits(StoredValueType) %
30103018
DL.getTypeSizeInBits(AllocatedEltTy) != 0)
30113019
return std::nullopt;
3020+
// If the stored value is a pointer, we do not handle it
3021+
// TODO: handle this case by using inttoptr/ptrtoint
3022+
if (StoredValueType->isPtrOrPtrVectorTy())
3023+
return std::nullopt;
30123024
StoreInfos.emplace_back(SI, S.beginOffset(), S.endOffset(),
30133025
SI->getValueOperand());
30143026
} else {

0 commit comments

Comments
 (0)