[llvm-branch-commits] [llvm] 1c82d32 - [CHR] Use pred_size (NFC)

Kazu Hirata via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Nov 24 22:57:38 PST 2020


Author: Kazu Hirata
Date: 2020-11-24T22:52:30-08:00
New Revision: 1c82d320893c9e93d8bd1d4a2aded7e4df4bdf30

URL: https://github.com/llvm/llvm-project/commit/1c82d320893c9e93d8bd1d4a2aded7e4df4bdf30
DIFF: https://github.com/llvm/llvm-project/commit/1c82d320893c9e93d8bd1d4a2aded7e4df4bdf30.diff

LOG: [CHR] Use pred_size (NFC)

Added: 
    

Modified: 
    llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp b/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp
index a99c58b74fb1..9bfb176dcd7f 100644
--- a/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp
+++ b/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp
@@ -1609,9 +1609,7 @@ static void insertTrivialPHIs(CHRScope *Scope,
         // Insert a trivial phi for I (phi [&I, P0], [&I, P1], ...) at
         // ExitBlock. Replace I with the new phi in UI unless UI is another
         // phi at ExitBlock.
-        unsigned PredCount = std::distance(pred_begin(ExitBlock),
-                                           pred_end(ExitBlock));
-        PHINode *PN = PHINode::Create(I.getType(), PredCount, "",
+        PHINode *PN = PHINode::Create(I.getType(), pred_size(ExitBlock), "",
                                       &ExitBlock->front());
         for (BasicBlock *Pred : predecessors(ExitBlock)) {
           PN->addIncoming(&I, Pred);


        


More information about the llvm-branch-commits mailing list