Skip to content

Commit fc0c8cb

Browse files
committed
Drop no longer necessary scalable type check
1 parent 4f4d272 commit fc0c8cb

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

llvm/lib/Transforms/InstCombine/InstructionCombining.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2711,7 +2711,6 @@ Instruction *InstCombinerImpl::visitGetElementPtrInst(GetElementPtrInst &GEP) {
27112711
SmallVector<Value *, 8> Indices(GEP.indices());
27122712
Type *GEPType = GEP.getType();
27132713
Type *GEPEltType = GEP.getSourceElementType();
2714-
bool IsGEPSrcEleScalable = GEPEltType->isScalableTy();
27152714
if (Value *V = simplifyGEPInst(GEPEltType, PtrOp, Indices, GEP.isInBounds(),
27162715
SQ.getWithInstruction(&GEP)))
27172716
return replaceInstUsesWith(GEP, V);
@@ -2789,7 +2788,7 @@ Instruction *InstCombinerImpl::visitGetElementPtrInst(GetElementPtrInst &GEP) {
27892788

27902789
// Canonicalize scalable GEPs to an explicit offset using the llvm.vscale
27912790
// intrinsic. This has better support in BasicAA.
2792-
if (IsGEPSrcEleScalable) {
2791+
if (GEPEltType->isScalableTy()) {
27932792
Value *Offset = EmitGEPOffset(cast<GEPOperator>(&GEP));
27942793
return replaceInstUsesWith(
27952794
GEP, Builder.CreatePtrAdd(PtrOp, Offset, "", GEP.isInBounds()));
@@ -2904,9 +2903,7 @@ Instruction *InstCombinerImpl::visitGetElementPtrInst(GetElementPtrInst &GEP) {
29042903
if (Instruction *I = visitGEPOfGEP(GEP, Src))
29052904
return I;
29062905

2907-
// Skip if GEP source element type is scalable. The type alloc size is unknown
2908-
// at compile-time.
2909-
if (GEP.getNumIndices() == 1 && !IsGEPSrcEleScalable) {
2906+
if (GEP.getNumIndices() == 1) {
29102907
unsigned AS = GEP.getPointerAddressSpace();
29112908
if (GEP.getOperand(1)->getType()->getScalarSizeInBits() ==
29122909
DL.getIndexSizeInBits(AS)) {

0 commit comments

Comments
 (0)