Skip to content

Commit cc91c58

Browse files
committed
Fixup
1 parent 6f9a251 commit cc91c58

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

llvm/lib/Transforms/InstCombine/InstructionCombining.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3119,8 +3119,7 @@ Instruction *InstCombinerImpl::visitGetElementPtrInst(GetElementPtrInst &GEP) {
31193119
// These rewrites is trying to preserve inbounds/nuw attributes. So we want to
31203120
// do this after having tried to derive "nuw" above.
31213121
if (GEP.getNumIndices() == 1) {
3122-
auto GetPreservedNoWrapFlags = [&](bool AddIsNUW, Value *Idx1,
3123-
Value *Idx2) {
3122+
auto GetPreservedNoWrapFlags = [&](bool AddIsNUW) {
31243123
// Preserve "inbounds nuw" if the original gep is "inbounds nuw", and the
31253124
// add is "nuw". Preserve "nuw" if the original gep is "nuw", and the add
31263125
// is "nuw".
@@ -3143,7 +3142,7 @@ Instruction *InstCombinerImpl::visitGetElementPtrInst(GetElementPtrInst &GEP) {
31433142
// %newptr = getelementptr i32, ptr %ptr, i64 %idx1
31443143
// %newgep = getelementptr i32, ptr %newptr, i64 %idx2
31453144
bool NUW = match(GEP.getOperand(1), m_NUWAddLike(m_Value(), m_Value()));
3146-
GEPNoWrapFlags NWFlags = GetPreservedNoWrapFlags(NUW, Idx1, Idx2);
3145+
GEPNoWrapFlags NWFlags = GetPreservedNoWrapFlags(NUW);
31473146
auto *NewPtr =
31483147
Builder.CreateGEP(GEP.getSourceElementType(), GEP.getPointerOperand(),
31493148
Idx1, "", NWFlags);
@@ -3162,7 +3161,7 @@ Instruction *InstCombinerImpl::visitGetElementPtrInst(GetElementPtrInst &GEP) {
31623161
// %newgep = getelementptr i32, ptr %newptr, i32 idx2
31633162
bool NUW = match(GEP.getOperand(1),
31643163
m_NNegZExt(m_NUWAddLike(m_Value(), m_Value())));
3165-
GEPNoWrapFlags NWFlags = GetPreservedNoWrapFlags(NUW, Idx1, C);
3164+
GEPNoWrapFlags NWFlags = GetPreservedNoWrapFlags(NUW);
31663165
auto *NewPtr = Builder.CreateGEP(
31673166
GEP.getSourceElementType(), GEP.getPointerOperand(),
31683167
Builder.CreateSExt(Idx1, GEP.getOperand(1)->getType()), "", NWFlags);

0 commit comments

Comments
 (0)