llvm.org GIT mirror llvm / 8f767d9
Simplify this code; these casts aren't necessary. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97048 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Gohman 10 years ago
1 changed file(s) with 4 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
920920 if (MaxBECount == RecastedMaxBECount) {
921921 const Type *WideTy = IntegerType::get(getContext(), BitWidth * 2);
922922 // Check whether Start+Step*MaxBECount has no unsigned overflow.
923 const SCEV *ZMul =
924 getMulExpr(CastedMaxBECount,
925 getTruncateOrZeroExtend(Step, Start->getType()));
923 const SCEV *ZMul = getMulExpr(CastedMaxBECount, Step);
926924 const SCEV *Add = getAddExpr(Start, ZMul);
927925 const SCEV *OperandExtendedAdd =
928926 getAddExpr(getZeroExtendExpr(Start, WideTy),
936934
937935 // Similar to above, only this time treat the step value as signed.
938936 // This covers loops that count down.
939 const SCEV *SMul =
940 getMulExpr(CastedMaxBECount,
941 getTruncateOrSignExtend(Step, Start->getType()));
937 const SCEV *SMul = getMulExpr(CastedMaxBECount, Step);
942938 Add = getAddExpr(Start, SMul);
943939 OperandExtendedAdd =
944940 getAddExpr(getZeroExtendExpr(Start, WideTy),
10591055 if (MaxBECount == RecastedMaxBECount) {
10601056 const Type *WideTy = IntegerType::get(getContext(), BitWidth * 2);
10611057 // Check whether Start+Step*MaxBECount has no signed overflow.
1062 const SCEV *SMul =
1063 getMulExpr(CastedMaxBECount,
1064 getTruncateOrSignExtend(Step, Start->getType()));
1058 const SCEV *SMul = getMulExpr(CastedMaxBECount, Step);
10651059 const SCEV *Add = getAddExpr(Start, SMul);
10661060 const SCEV *OperandExtendedAdd =
10671061 getAddExpr(getSignExtendExpr(Start, WideTy),
10751069
10761070 // Similar to above, only this time treat the step value as unsigned.
10771071 // This covers loops that count up with an unsigned step.
1078 const SCEV *UMul =
1079 getMulExpr(CastedMaxBECount,
1080 getTruncateOrZeroExtend(Step, Start->getType()));
1072 const SCEV *UMul = getMulExpr(CastedMaxBECount, Step);
10811073 Add = getAddExpr(Start, UMul);
10821074 OperandExtendedAdd =
10831075 getAddExpr(getSignExtendExpr(Start, WideTy),