@@ -767,14 +767,23 @@ unsigned LoopPredication::widenChecks(SmallVectorImpl<Value *> &Checks,
767
767
return NumWidened;
768
768
}
769
769
770
- bool LoopPredication::widenGuardConditions (IntrinsicInst *Guard,
771
- SCEVExpander &Expander) {
770
+ static SmallVector<Value *> extractChecksFromGuard (Instruction *Guard) {
772
771
LLVM_DEBUG (dbgs () << " Processing guard:\n " );
773
772
LLVM_DEBUG (Guard->dump ());
774
773
775
- TotalConsidered++;
776
774
SmallVector<Value *, 4 > Checks;
777
775
parseWidenableGuard (Guard, Checks);
776
+ LLVM_DEBUG (dbgs () << " Found checks:\n " );
777
+ std::for_each (Checks.begin (), Checks.end (), [](const Value *Check) {
778
+ LLVM_DEBUG (dbgs () << *Check << " \n " );
779
+ });
780
+ return Checks;
781
+ }
782
+
783
+ bool LoopPredication::widenGuardConditions (IntrinsicInst *Guard,
784
+ SCEVExpander &Expander) {
785
+ TotalConsidered++;
786
+ auto Checks = extractChecksFromGuard (Guard);
778
787
unsigned NumWidened = widenChecks (Checks, Expander, Guard);
779
788
if (NumWidened == 0 )
780
789
return false ;
@@ -799,8 +808,6 @@ bool LoopPredication::widenGuardConditions(IntrinsicInst *Guard,
799
808
bool LoopPredication::widenWidenableBranchGuardConditions (
800
809
BranchInst *BI, SCEVExpander &Expander) {
801
810
assert (isGuardAsWidenableBranch (BI) && " Must be!" );
802
- LLVM_DEBUG (dbgs () << " Processing guard:\n " );
803
- LLVM_DEBUG (BI->dump ());
804
811
805
812
Value *Cond, *WC;
806
813
BasicBlock *IfTrueBB, *IfFalseBB;
@@ -809,8 +816,7 @@ bool LoopPredication::widenWidenableBranchGuardConditions(
809
816
(void )Parsed;
810
817
811
818
TotalConsidered++;
812
- SmallVector<Value *, 4 > Checks;
813
- parseWidenableGuard (BI, Checks);
819
+ auto Checks = extractChecksFromGuard (BI);
814
820
// At the moment, our matching logic for wideable conditions implicitly
815
821
// assumes we preserve the form: (br (and Cond, WC())). FIXME
816
822
Checks.push_back (WC);
0 commit comments