SCEV: When expanding a GEP the final addition to the base pointer has NUW but not NSW.

Found by inspection.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154262 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer 2012-04-07 17:19:26 +00:00
parent 93abbc272a
commit c77764591b
3 changed files with 6 additions and 6 deletions

View File

@ -3187,7 +3187,7 @@ const SCEV *ScalarEvolution::createNodeForGEP(GEPOperator *GEP) {
// Add the total offset from all the GEP indices to the base.
return getAddExpr(BaseS, TotalOffset,
isInBounds ? SCEV::FlagNSW : SCEV::FlagAnyWrap);
isInBounds ? SCEV::FlagNUW : SCEV::FlagAnyWrap);
}
/// GetMinTrailingZeros - Determine the minimum number of zero bits that S is

View File

@ -23,7 +23,7 @@ bb: ; preds = %bb.nph, %bb1
%1 = sext i32 %i.01 to i64 ; <i64> [#uses=1]
; CHECK: %2 = getelementptr inbounds double* %d, i64 %1
; CHECK: --> {%d,+,16}<nsw><%bb>
; CHECK: --> {%d,+,16}<nuw><%bb>
%2 = getelementptr inbounds double* %d, i64 %1 ; <double*> [#uses=1]
%3 = load double* %2, align 8 ; <double> [#uses=1]
@ -37,7 +37,7 @@ bb: ; preds = %bb.nph, %bb1
%8 = sext i32 %7 to i64 ; <i64> [#uses=1]
; CHECK: %9 = getelementptr inbounds double* %q, i64 %8
; CHECK: {(8 + %q),+,16}<nsw><%bb>
; CHECK: {(8 + %q),+,16}<nuw><%bb>
%9 = getelementptr inbounds double* %q, i64 %8 ; <double*> [#uses=1]
; Artificially repeat the above three instructions, this time using
@ -49,7 +49,7 @@ bb: ; preds = %bb.nph, %bb1
%t8 = sext i32 %t7 to i64 ; <i64> [#uses=1]
; CHECK: %t9 = getelementptr inbounds double* %q, i64 %t8
; CHECK: {(8 + %q),+,16}<nsw><%bb>
; CHECK: {(8 + %q),+,16}<nuw><%bb>
%t9 = getelementptr inbounds double* %q, i64 %t8 ; <double*> [#uses=1]
%10 = load double* %9, align 8 ; <double> [#uses=1]

View File

@ -92,10 +92,10 @@ for.body.i.i: ; preds = %entry, %for.body.i.
; CHECK: {1,+,1}<nuw><nsw><%for.body.i.i>
%ptrincdec.i.i = getelementptr inbounds i32* %begin, i64 %tmp
; CHECK: %ptrincdec.i.i =
; CHECK: {(4 + %begin),+,4}<nsw><%for.body.i.i>
; CHECK: {(4 + %begin),+,4}<nuw><%for.body.i.i>
%__first.addr.08.i.i = getelementptr inbounds i32* %begin, i64 %indvar.i.i
; CHECK: %__first.addr.08.i.i
; CHECK: {%begin,+,4}<nsw><%for.body.i.i>
; CHECK: {%begin,+,4}<nuw><%for.body.i.i>
store i32 0, i32* %__first.addr.08.i.i, align 4
%cmp.i.i = icmp eq i32* %ptrincdec.i.i, %end
br i1 %cmp.i.i, label %_ZSt4fillIPiiEvT_S1_RKT0_.exit, label %for.body.i.i