llvm.org GIT mirror llvm / a1af757
Extend ScalarEvolution's getBackedgeTakenCount to be able to compute an upper-bound value for the trip count, in addition to the actual trip count. Use this to allow getZeroExtendExpr and getSignExtendExpr to fold casts in more cases. This may eventually morph into a more general value-range analysis capability; there are certainly plenty of places where more complete value-range information would allow more folding. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70509 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Gohman 11 years ago
5 changed file(s) with 278 addition(s) and 71 deletion(s). Raw diff Collapse all Expand all
216216 ///
217217 std::map Scalars;
218218
219 /// BackedgeTakenInfo - Information about the backedge-taken count
220 /// of a loop. This currently inclues an exact count and a maximum count.
221 ///
222 struct BackedgeTakenInfo {
223 /// Exact - An expression indicating the exact backedge-taken count of
224 /// the loop if it is known, or a SCEVCouldNotCompute otherwise.
225 SCEVHandle Exact;
226
227 /// Exact - An expression indicating the least maximum backedge-taken
228 /// count of the loop that is known, or a SCEVCouldNotCompute.
229 SCEVHandle Max;
230
231 /*implicit*/ BackedgeTakenInfo(SCEVHandle exact) :
232 Exact(exact), Max(exact) {}
233
234 /*implicit*/ BackedgeTakenInfo(SCEV *exact) :
235 Exact(exact), Max(exact) {}
236
237 BackedgeTakenInfo(SCEVHandle exact, SCEVHandle max) :
238 Exact(exact), Max(max) {}
239
240 /// hasAnyInfo - Test whether this BackedgeTakenInfo contains any
241 /// computed information, or whether it's all SCEVCouldNotCompute
242 /// values.
243 bool hasAnyInfo() const {
244 return !isa(Exact) ||
245 !isa(Max);
246 }
247 };
248
219249 /// BackedgeTakenCounts - Cache the backedge-taken count of the loops for
220250 /// this function as they are computed.
221 std::mapSCEVHandle> BackedgeTakenCounts;
251 std::mapBackedgeTakenInfo> BackedgeTakenCounts;
222252
223253 /// ConstantEvolutionLoopExitValue - This map contains entries for all of
224254 /// the PHI instructions that we attempt to compute constant evolutions for.
243273 const SCEVHandle &SymName,
244274 const SCEVHandle &NewVal);
245275
276 /// getBackedgeTakenInfo - Return the BackedgeTakenInfo for the given
277 /// loop, lazily computing new values if the loop hasn't been analyzed
278 /// yet.
279 const BackedgeTakenInfo &getBackedgeTakenInfo(const Loop *L);
280
246281 /// ComputeBackedgeTakenCount - Compute the number of times the specified
247282 /// loop will iterate.
248 SCEVHandle ComputeBackedgeTakenCount(const Loop *L);
283 BackedgeTakenInfo ComputeBackedgeTakenCount(const Loop *L);
249284
250285 /// ComputeLoadConstantCompareBackedgeTakenCount - Given an exit condition
251286 /// of 'icmp op load X, cst', try to see if we can compute the trip count.
276311 /// HowManyLessThans - Return the number of times a backedge containing the
277312 /// specified less-than comparison will execute. If not computable, return
278313 /// UnknownValue. isSigned specifies whether the less-than is signed.
279 SCEVHandle HowManyLessThans(SCEV *LHS, SCEV *RHS, const Loop *L,
280 bool isSigned);
314 BackedgeTakenInfo HowManyLessThans(SCEV *LHS, SCEV *RHS, const Loop *L,
315 bool isSigned);
281316
282317 /// getPredecessorWithUniqueSuccessorForBB - Return a predecessor of BB
283318 /// (which may not be an immediate predecessor) which has exactly one
430465 ///
431466 SCEVHandle getBackedgeTakenCount(const Loop *L);
432467
468 /// getMaxBackedgeTakenCount - Similar to getBackedgeTakenCount, except
469 /// return the least SCEV value that is known never to be less than the
470 /// actual backedge taken count.
471 SCEVHandle getMaxBackedgeTakenCount(const Loop *L);
472
433473 /// hasLoopInvariantBackedgeTakenCount - Return true if the specified loop
434474 /// has an analyzable loop-invariant backedge-taken count.
435475 bool hasLoopInvariantBackedgeTakenCount(const Loop *L);
714714 // in infinite recursion. In the later case, the analysis code will
715715 // cope with a conservative value, and it will take care to purge
716716 // that value once it has finished.
717 SCEVHandle BECount = getBackedgeTakenCount(AR->getLoop());
718 if (!isa(BECount)) {
717 SCEVHandle MaxBECount = getMaxBackedgeTakenCount(AR->getLoop());
718 if (!isa(MaxBECount)) {
719719 // Manually compute the final value for AR, checking for
720720 // overflow.
721721 SCEVHandle Start = AR->getStart();
723723
724724 // Check whether the backedge-taken count can be losslessly casted to
725725 // the addrec's type. The count is always unsigned.
726 SCEVHandle CastedBECount =
727 getTruncateOrZeroExtend(BECount, Start->getType());
728 if (BECount ==
729 getTruncateOrZeroExtend(CastedBECount, BECount->getType())) {
726 SCEVHandle CastedMaxBECount =
727 getTruncateOrZeroExtend(MaxBECount, Start->getType());
728 if (MaxBECount ==
729 getTruncateOrZeroExtend(CastedMaxBECount, MaxBECount->getType())) {
730730 const Type *WideTy =
731731 IntegerType::get(getTypeSizeInBits(Start->getType()) * 2);
732 // Check whether Start+Step*BECount has no unsigned overflow.
732 // Check whether Start+Step*MaxBECount has no unsigned overflow.
733733 SCEVHandle ZMul =
734 getMulExpr(CastedBECount,
734 getMulExpr(CastedMaxBECount,
735735 getTruncateOrZeroExtend(Step, Start->getType()));
736736 SCEVHandle Add = getAddExpr(Start, ZMul);
737737 if (getZeroExtendExpr(Add, WideTy) ==
738738 getAddExpr(getZeroExtendExpr(Start, WideTy),
739 getMulExpr(getZeroExtendExpr(CastedBECount, WideTy),
739 getMulExpr(getZeroExtendExpr(CastedMaxBECount, WideTy),
740740 getZeroExtendExpr(Step, WideTy))))
741741 // Return the expression with the addrec on the outside.
742742 return getAddRecExpr(getZeroExtendExpr(Start, Ty),
746746 // Similar to above, only this time treat the step value as signed.
747747 // This covers loops that count down.
748748 SCEVHandle SMul =
749 getMulExpr(CastedBECount,
749 getMulExpr(CastedMaxBECount,
750750 getTruncateOrSignExtend(Step, Start->getType()));
751751 Add = getAddExpr(Start, SMul);
752752 if (getZeroExtendExpr(Add, WideTy) ==
753753 getAddExpr(getZeroExtendExpr(Start, WideTy),
754 getMulExpr(getZeroExtendExpr(CastedBECount, WideTy),
754 getMulExpr(getZeroExtendExpr(CastedMaxBECount, WideTy),
755755 getSignExtendExpr(Step, WideTy))))
756756 // Return the expression with the addrec on the outside.
757757 return getAddRecExpr(getZeroExtendExpr(Start, Ty),
796796 // in infinite recursion. In the later case, the analysis code will
797797 // cope with a conservative value, and it will take care to purge
798798 // that value once it has finished.
799 SCEVHandle BECount = getBackedgeTakenCount(AR->getLoop());
800 if (!isa(BECount)) {
799 SCEVHandle MaxBECount = getMaxBackedgeTakenCount(AR->getLoop());
800 if (!isa(MaxBECount)) {
801801 // Manually compute the final value for AR, checking for
802802 // overflow.
803803 SCEVHandle Start = AR->getStart();
805805
806806 // Check whether the backedge-taken count can be losslessly casted to
807807 // the addrec's type. The count is always unsigned.
808 SCEVHandle CastedBECount =
809 getTruncateOrZeroExtend(BECount, Start->getType());
810 if (BECount ==
811 getTruncateOrZeroExtend(CastedBECount, BECount->getType())) {
808 SCEVHandle CastedMaxBECount =
809 getTruncateOrZeroExtend(MaxBECount, Start->getType());
810 if (MaxBECount ==
811 getTruncateOrZeroExtend(CastedMaxBECount, MaxBECount->getType())) {
812812 const Type *WideTy =
813813 IntegerType::get(getTypeSizeInBits(Start->getType()) * 2);
814 // Check whether Start+Step*BECount has no signed overflow.
814 // Check whether Start+Step*MaxBECount has no signed overflow.
815815 SCEVHandle SMul =
816 getMulExpr(CastedBECount,
816 getMulExpr(CastedMaxBECount,
817817 getTruncateOrSignExtend(Step, Start->getType()));
818818 SCEVHandle Add = getAddExpr(Start, SMul);
819819 if (getSignExtendExpr(Add, WideTy) ==
820820 getAddExpr(getSignExtendExpr(Start, WideTy),
821 getMulExpr(getZeroExtendExpr(CastedBECount, WideTy),
821 getMulExpr(getZeroExtendExpr(CastedMaxBECount, WideTy),
822822 getSignExtendExpr(Step, WideTy))))
823823 // Return the expression with the addrec on the outside.
824824 return getAddRecExpr(getSignExtendExpr(Start, Ty),
20592059 /// hasLoopInvariantBackedgeTakenCount).
20602060 ///
20612061 SCEVHandle ScalarEvolution::getBackedgeTakenCount(const Loop *L) {
2062 return getBackedgeTakenInfo(L).Exact;
2063 }
2064
2065 /// getMaxBackedgeTakenCount - Similar to getBackedgeTakenCount, except
2066 /// return the least SCEV value that is known never to be less than the
2067 /// actual backedge taken count.
2068 SCEVHandle ScalarEvolution::getMaxBackedgeTakenCount(const Loop *L) {
2069 return getBackedgeTakenInfo(L).Max;
2070 }
2071
2072 const ScalarEvolution::BackedgeTakenInfo &
2073 ScalarEvolution::getBackedgeTakenInfo(const Loop *L) {
20622074 // Initially insert a CouldNotCompute for this loop. If the insertion
20632075 // succeeds, procede to actually compute a backedge-taken count and
20642076 // update the value. The temporary CouldNotCompute value tells SCEV
20652077 // code elsewhere that it shouldn't attempt to request a new
20662078 // backedge-taken count, which could result in infinite recursion.
2067 std::pairSCEVHandle>::iterator, bool> Pair =
2079 std::pairBackedgeTakenInfo>::iterator, bool> Pair =
20682080 BackedgeTakenCounts.insert(std::make_pair(L, getCouldNotCompute()));
20692081 if (Pair.second) {
2070 SCEVHandle ItCount = ComputeBackedgeTakenCount(L);
2071 if (ItCount != UnknownValue) {
2072 assert(ItCount->isLoopInvariant(L) &&
2082 BackedgeTakenInfo ItCount = ComputeBackedgeTakenCount(L);
2083 if (ItCount.Exact != UnknownValue) {
2084 assert(ItCount.Exact->isLoopInvariant(L) &&
2085 ItCount.Max->isLoopInvariant(L) &&
20732086 "Computed trip count isn't loop invariant for loop!");
20742087 ++NumTripCountsComputed;
2075
2076 // Now that we know the trip count for this loop, forget any
2077 // existing SCEV values for PHI nodes in this loop since they
2078 // are only conservative estimates made without the benefit
2079 // of trip count information.
2080 for (BasicBlock::iterator I = L->getHeader()->begin();
2081 PHINode *PN = dyn_cast(I); ++I)
2082 deleteValueFromRecords(PN);
20832088
20842089 // Update the value in the map.
20852090 Pair.first->second = ItCount;
20872092 // Only count loops that have phi nodes as not being computable.
20882093 ++NumTripCountsNotComputed;
20892094 }
2095
2096 // Now that we know more about the trip count for this loop, forget any
2097 // existing SCEV values for PHI nodes in this loop since they are only
2098 // conservative estimates made without the benefit
2099 // of trip count information.
2100 if (ItCount.hasAnyInfo())
2101 for (BasicBlock::iterator I = L->getHeader()->begin();
2102 PHINode *PN = dyn_cast(I); ++I)
2103 deleteValueFromRecords(PN);
20902104 }
20912105 return Pair.first->second;
20922106 }
21012115
21022116 /// ComputeBackedgeTakenCount - Compute the number of times the backedge
21032117 /// of the specified loop will execute.
2104 SCEVHandle ScalarEvolution::ComputeBackedgeTakenCount(const Loop *L) {
2118 ScalarEvolution::BackedgeTakenInfo
2119 ScalarEvolution::ComputeBackedgeTakenCount(const Loop *L) {
21052120 // If the loop has a non-one exit block count, we can't analyze it.
21062121 SmallVector ExitBlocks;
21072122 L->getExitBlocks(ExitBlocks);
22222237 break;
22232238 }
22242239 case ICmpInst::ICMP_SLT: {
2225 SCEVHandle TC = HowManyLessThans(LHS, RHS, L, true);
2226 if (!isa(TC)) return TC;
2240 BackedgeTakenInfo BTI = HowManyLessThans(LHS, RHS, L, true);
2241 if (BTI.hasAnyInfo()) return BTI;
22272242 break;
22282243 }
22292244 case ICmpInst::ICMP_SGT: {
2230 SCEVHandle TC = HowManyLessThans(getNotSCEV(LHS),
2231 getNotSCEV(RHS), L, true);
2232 if (!isa(TC)) return TC;
2245 BackedgeTakenInfo BTI = HowManyLessThans(getNotSCEV(LHS),
2246 getNotSCEV(RHS), L, true);
2247 if (BTI.hasAnyInfo()) return BTI;
22332248 break;
22342249 }
22352250 case ICmpInst::ICMP_ULT: {
2236 SCEVHandle TC = HowManyLessThans(LHS, RHS, L, false);
2237 if (!isa(TC)) return TC;
2251 BackedgeTakenInfo BTI = HowManyLessThans(LHS, RHS, L, false);
2252 if (BTI.hasAnyInfo()) return BTI;
22382253 break;
22392254 }
22402255 case ICmpInst::ICMP_UGT: {
2241 SCEVHandle TC = HowManyLessThans(getNotSCEV(LHS),
2242 getNotSCEV(RHS), L, false);
2243 if (!isa(TC)) return TC;
2256 BackedgeTakenInfo BTI = HowManyLessThans(getNotSCEV(LHS),
2257 getNotSCEV(RHS), L, false);
2258 if (BTI.hasAnyInfo()) return BTI;
22442259 break;
22452260 }
22462261 default:
30923107 /// HowManyLessThans - Return the number of times a backedge containing the
30933108 /// specified less-than comparison will execute. If not computable, return
30943109 /// UnknownValue.
3095 SCEVHandle ScalarEvolution::
3110 ScalarEvolution::BackedgeTakenInfo ScalarEvolution::
30963111 HowManyLessThans(SCEV *LHS, SCEV *RHS, const Loop *L, bool isSigned) {
30973112 // Only handle: "ADDREC < LoopInvariant".
30983113 if (!RHS->isLoopInvariant(L)) return UnknownValue;
31033118
31043119 if (AddRec->isAffine()) {
31053120 // FORNOW: We only support unit strides.
3106 SCEVHandle One = getIntegerSCEV(1, RHS->getType());
3107 if (AddRec->getOperand(1) != One)
3121 unsigned BitWidth = getTypeSizeInBits(AddRec->getType());
3122 SCEVHandle Step = AddRec->getStepRecurrence(*this);
3123 SCEVHandle NegOne = getIntegerSCEV(-1, AddRec->getType());
3124
3125 // TODO: handle non-constant strides.
3126 const SCEVConstant *CStep = dyn_cast(Step);
3127 if (!CStep || CStep->isZero())
31083128 return UnknownValue;
3109
3110 // We know the LHS is of the form {n,+,1} and the RHS is some loop-invariant
3111 // m. So, we count the number of iterations in which {n,+,1} < m is true.
3112 // Note that we cannot simply return max(m-n,0) because it's not safe to
3129 if (CStep->getValue()->getValue() == 1) {
3130 // With unit stride, the iteration never steps past the limit value.
3131 } else if (CStep->getValue()->getValue().isStrictlyPositive()) {
3132 if (const SCEVConstant *CLimit = dyn_cast(RHS)) {
3133 // Test whether a positive iteration iteration can step past the limit
3134 // value and past the maximum value for its type in a single step.
3135 if (isSigned) {
3136 APInt Max = APInt::getSignedMaxValue(BitWidth);
3137 if ((Max - CStep->getValue()->getValue())
3138 .slt(CLimit->getValue()->getValue()))
3139 return UnknownValue;
3140 } else {
3141 APInt Max = APInt::getMaxValue(BitWidth);
3142 if ((Max - CStep->getValue()->getValue())
3143 .ult(CLimit->getValue()->getValue()))
3144 return UnknownValue;
3145 }
3146 } else
3147 // TODO: handle non-constant limit values below.
3148 return UnknownValue;
3149 } else
3150 // TODO: handle negative strides below.
3151 return UnknownValue;
3152
3153 // We know the LHS is of the form {n,+,s} and the RHS is some loop-invariant
3154 // m. So, we count the number of iterations in which {n,+,s} < m is true.
3155 // Note that we cannot simply return max(m-n,0)/s because it's not safe to
31133156 // treat m-n as signed nor unsigned due to overflow possibility.
31143157
31153158 // First, we get the value of the LHS in the first iteration: n
31163159 SCEVHandle Start = AddRec->getOperand(0);
31173160
3118 if (isLoopGuardedByCond(L,
3119 isSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT,
3120 getMinusSCEV(AddRec->getOperand(0), One), RHS)) {
3121 // Since we know that the condition is true in order to enter the loop,
3122 // we know that it will run exactly m-n times.
3123 return getMinusSCEV(RHS, Start);
3124 } else {
3125 // Then, we get the value of the LHS in the first iteration in which the
3126 // above condition doesn't hold. This equals to max(m,n).
3127 SCEVHandle End = isSigned ? getSMaxExpr(RHS, Start)
3128 : getUMaxExpr(RHS, Start);
3129
3130 // Finally, we subtract these two values to get the number of times the
3131 // backedge is executed: max(m,n)-n.
3132 return getMinusSCEV(End, Start);
3133 }
3161 // Determine the minimum constant start value.
3162 SCEVHandle MinStart = isa(Start) ? Start :
3163 getConstant(isSigned ? APInt::getSignedMinValue(BitWidth) :
3164 APInt::getMinValue(BitWidth));
3165
3166 // If we know that the condition is true in order to enter the loop,
3167 // then we know that it will run exactly (m-n)/s times. Otherwise, we
3168 // only know if will execute (max(m,n)-n)/s times. In both cases, the
3169 // division must round up.
3170 SCEVHandle End = RHS;
3171 if (!isLoopGuardedByCond(L,
3172 isSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT,
3173 getMinusSCEV(Start, Step), RHS))
3174 End = isSigned ? getSMaxExpr(RHS, Start)
3175 : getUMaxExpr(RHS, Start);
3176
3177 // Determine the maximum constant end value.
3178 SCEVHandle MaxEnd = isa(End) ? End :
3179 getConstant(isSigned ? APInt::getSignedMaxValue(BitWidth) :
3180 APInt::getMaxValue(BitWidth));
3181
3182 // Finally, we subtract these two values and divide, rounding up, to get
3183 // the number of times the backedge is executed.
3184 SCEVHandle BECount = getUDivExpr(getAddExpr(getMinusSCEV(End, Start),
3185 getAddExpr(Step, NegOne)),
3186 Step);
3187
3188 // The maximum backedge count is similar, except using the minimum start
3189 // value and the maximum end value.
3190 SCEVHandle MaxBECount = getUDivExpr(getAddExpr(getMinusSCEV(MaxEnd,
3191 MinStart),
3192 getAddExpr(Step, NegOne)),
3193 Step);
3194
3195 return BackedgeTakenInfo(BECount, MaxBECount);
31343196 }
31353197
31363198 return UnknownValue;
0 ; RUN: llvm-as < %s | opt -analyze -scalar-evolution |& grep {/u 3}
1 ; XFAIL: *
21
32 define i32 @f(i32 %x) nounwind readnone {
43 entry:
0 ; RUN: llvm-as < %s | opt -analyze -scalar-evolution -disable-output \
1 ; RUN: | grep {\{(ptrtoint i32\\* %d to iPTR),+,4\}}
2
3 define void @foo(i32* nocapture %d, i32 %n) nounwind {
4 entry:
5 %0 = icmp sgt i32 %n, 0 ; [#uses=1]
6 br i1 %0, label %bb.nph, label %return
7
8 bb.nph: ; preds = %entry
9 br label %bb
10
11 bb: ; preds = %bb1, %bb.nph
12 %i.02 = phi i32 [ %5, %bb1 ], [ 0, %bb.nph ] ; [#uses=2]
13 %p.01 = phi i8 [ %4, %bb1 ], [ -1, %bb.nph ] ; [#uses=2]
14 %1 = sext i8 %p.01 to i32 ; [#uses=1]
15 %2 = sext i32 %i.02 to i64 ; [#uses=1]
16 %3 = getelementptr i32* %d, i64 %2 ; [#uses=1]
17 store i32 %1, i32* %3, align 4
18 %4 = add i8 %p.01, 1 ; [#uses=1]
19 %5 = add i32 %i.02, 1 ; [#uses=2]
20 br label %bb1
21
22 bb1: ; preds = %bb
23 %6 = icmp slt i32 %5, %n ; [#uses=1]
24 br i1 %6, label %bb, label %bb1.return_crit_edge
25
26 bb1.return_crit_edge: ; preds = %bb1
27 br label %return
28
29 return: ; preds = %bb1.return_crit_edge, %entry
30 ret void
31 }
0 ; RUN: llvm-as < %s | opt -scalar-evolution -analyze -disable-output \
1 ; RUN: | grep {backedge-taken count is ((64 + (-64 smax (-1 + (-1 \\* %0))) + %0) /u 64)}
2
3 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
4 target triple = "x86_64-unknown-linux-gnu"
5 %struct.FILE = type { i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct._IO_marker*, %struct.FILE*, i32, i32, i64, i16, i8, [1 x i8], i8*, i64, i8*, i8*, i8*, i8*, i64, i32, [20 x i8] }
6 %struct.SHA_INFO = type { [5 x i32], i32, i32, [16 x i32] }
7 %struct._IO_marker = type { %struct._IO_marker*, %struct.FILE*, i32 }
8 @_2E_str = external constant [26 x i8] ; <[26 x i8]*> [#uses=0]
9 @stdin = external global %struct.FILE* ; <%struct.FILE**> [#uses=0]
10 @_2E_str1 = external constant [3 x i8] ; <[3 x i8]*> [#uses=0]
11 @_2E_str12 = external constant [30 x i8] ; <[30 x i8]*> [#uses=0]
12
13 declare void @sha_init(%struct.SHA_INFO* nocapture) nounwind
14
15 declare fastcc void @sha_transform(%struct.SHA_INFO* nocapture) nounwind
16
17 declare void @sha_print(%struct.SHA_INFO* nocapture) nounwind
18
19 declare i32 @printf(i8* nocapture, ...) nounwind
20
21 declare void @sha_final(%struct.SHA_INFO* nocapture) nounwind
22
23 declare void @llvm.memset.i64(i8* nocapture, i8, i64, i32) nounwind
24
25 declare void @sha_update(%struct.SHA_INFO* nocapture, i8* nocapture, i32) nounwind
26
27 declare void @llvm.memcpy.i64(i8* nocapture, i8* nocapture, i64, i32) nounwind
28
29 declare i64 @fread(i8* noalias nocapture, i64, i64, %struct.FILE* noalias nocapture) nounwind
30
31 declare i32 @main(i32, i8** nocapture) nounwind
32
33 declare noalias %struct.FILE* @fopen(i8* noalias nocapture, i8* noalias nocapture) nounwind
34
35 declare i32 @fclose(%struct.FILE* nocapture) nounwind
36
37 declare void @sha_stream(%struct.SHA_INFO* nocapture, %struct.FILE* nocapture) nounwind
38
39 define void @sha_stream_bb3_2E_i(%struct.SHA_INFO* %sha_info, i8* %data1, i32, i8** %buffer_addr.0.i.out, i32* %count_addr.0.i.out) nounwind {
40 newFuncRoot:
41 br label %bb3.i
42
43 sha_update.exit.exitStub: ; preds = %bb3.i
44 store i8* %buffer_addr.0.i, i8** %buffer_addr.0.i.out
45 store i32 %count_addr.0.i, i32* %count_addr.0.i.out
46 ret void
47
48 bb2.i: ; preds = %bb3.i
49 %1 = getelementptr %struct.SHA_INFO* %sha_info, i64 0, i32 3 ; <[16 x i32]*> [#uses=1]
50 %2 = bitcast [16 x i32]* %1 to i8* ; [#uses=1]
51 call void @llvm.memcpy.i64(i8* %2, i8* %buffer_addr.0.i, i64 64, i32 1) nounwind
52 %3 = getelementptr %struct.SHA_INFO* %sha_info, i64 0, i32 3, i64 0 ; [#uses=1]
53 %4 = bitcast i32* %3 to i8* ; [#uses=1]
54 br label %codeRepl
55
56 codeRepl: ; preds = %bb2.i
57 call void @sha_stream_bb3_2E_i_bb1_2E_i_2E_i(i8* %4)
58 br label %byte_reverse.exit.i
59
60 byte_reverse.exit.i: ; preds = %codeRepl
61 call fastcc void @sha_transform(%struct.SHA_INFO* %sha_info) nounwind
62 %5 = getelementptr i8* %buffer_addr.0.i, i64 64 ; [#uses=1]
63 %6 = add i32 %count_addr.0.i, -64 ; [#uses=1]
64 br label %bb3.i
65
66 bb3.i: ; preds = %byte_reverse.exit.i, %newFuncRoot
67 %buffer_addr.0.i = phi i8* [ %data1, %newFuncRoot ], [ %5, %byte_reverse.exit.i ] ; [#uses=3]
68 %count_addr.0.i = phi i32 [ %0, %newFuncRoot ], [ %6, %byte_reverse.exit.i ] ; [#uses=3]
69 %7 = icmp sgt i32 %count_addr.0.i, 63 ; [#uses=1]
70 br i1 %7, label %bb2.i, label %sha_update.exit.exitStub
71 }
72
73 declare void @sha_stream_bb3_2E_i_bb1_2E_i_2E_i(i8*) nounwind