@@ -3119,8 +3119,7 @@ Instruction *InstCombinerImpl::visitGetElementPtrInst(GetElementPtrInst &GEP) {
3119
3119
// These rewrites is trying to preserve inbounds/nuw attributes. So we want to
3120
3120
// do this after having tried to derive "nuw" above.
3121
3121
if (GEP.getNumIndices () == 1 ) {
3122
- auto GetPreservedNoWrapFlags = [&](bool AddIsNUW, Value *Idx1,
3123
- Value *Idx2) {
3122
+ auto GetPreservedNoWrapFlags = [&](bool AddIsNUW) {
3124
3123
// Preserve "inbounds nuw" if the original gep is "inbounds nuw", and the
3125
3124
// add is "nuw". Preserve "nuw" if the original gep is "nuw", and the add
3126
3125
// is "nuw".
@@ -3143,7 +3142,7 @@ Instruction *InstCombinerImpl::visitGetElementPtrInst(GetElementPtrInst &GEP) {
3143
3142
// %newptr = getelementptr i32, ptr %ptr, i64 %idx1
3144
3143
// %newgep = getelementptr i32, ptr %newptr, i64 %idx2
3145
3144
bool NUW = match (GEP.getOperand (1 ), m_NUWAddLike (m_Value (), m_Value ()));
3146
- GEPNoWrapFlags NWFlags = GetPreservedNoWrapFlags (NUW, Idx1, Idx2 );
3145
+ GEPNoWrapFlags NWFlags = GetPreservedNoWrapFlags (NUW);
3147
3146
auto *NewPtr =
3148
3147
Builder.CreateGEP (GEP.getSourceElementType (), GEP.getPointerOperand (),
3149
3148
Idx1, " " , NWFlags);
@@ -3162,7 +3161,7 @@ Instruction *InstCombinerImpl::visitGetElementPtrInst(GetElementPtrInst &GEP) {
3162
3161
// %newgep = getelementptr i32, ptr %newptr, i32 idx2
3163
3162
bool NUW = match (GEP.getOperand (1 ),
3164
3163
m_NNegZExt (m_NUWAddLike (m_Value (), m_Value ())));
3165
- GEPNoWrapFlags NWFlags = GetPreservedNoWrapFlags (NUW, Idx1, C );
3164
+ GEPNoWrapFlags NWFlags = GetPreservedNoWrapFlags (NUW);
3166
3165
auto *NewPtr = Builder.CreateGEP (
3167
3166
GEP.getSourceElementType (), GEP.getPointerOperand (),
3168
3167
Builder.CreateSExt (Idx1, GEP.getOperand (1 )->getType ()), " " , NWFlags);
0 commit comments