@@ -2711,7 +2711,6 @@ Instruction *InstCombinerImpl::visitGetElementPtrInst(GetElementPtrInst &GEP) {
2711
2711
SmallVector<Value *, 8 > Indices (GEP.indices ());
2712
2712
Type *GEPType = GEP.getType ();
2713
2713
Type *GEPEltType = GEP.getSourceElementType ();
2714
- bool IsGEPSrcEleScalable = GEPEltType->isScalableTy ();
2715
2714
if (Value *V = simplifyGEPInst (GEPEltType, PtrOp, Indices, GEP.isInBounds (),
2716
2715
SQ.getWithInstruction (&GEP)))
2717
2716
return replaceInstUsesWith (GEP, V);
@@ -2789,7 +2788,7 @@ Instruction *InstCombinerImpl::visitGetElementPtrInst(GetElementPtrInst &GEP) {
2789
2788
2790
2789
// Canonicalize scalable GEPs to an explicit offset using the llvm.vscale
2791
2790
// intrinsic. This has better support in BasicAA.
2792
- if (IsGEPSrcEleScalable ) {
2791
+ if (GEPEltType-> isScalableTy () ) {
2793
2792
Value *Offset = EmitGEPOffset (cast<GEPOperator>(&GEP));
2794
2793
return replaceInstUsesWith (
2795
2794
GEP, Builder.CreatePtrAdd (PtrOp, Offset, " " , GEP.isInBounds ()));
@@ -2904,9 +2903,7 @@ Instruction *InstCombinerImpl::visitGetElementPtrInst(GetElementPtrInst &GEP) {
2904
2903
if (Instruction *I = visitGEPOfGEP (GEP, Src))
2905
2904
return I;
2906
2905
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 ) {
2910
2907
unsigned AS = GEP.getPointerAddressSpace ();
2911
2908
if (GEP.getOperand (1 )->getType ()->getScalarSizeInBits () ==
2912
2909
DL.getIndexSizeInBits (AS)) {
0 commit comments