[PATCH] D154996: [ConstantHoisting] use BasicBlock::getFirstInsertionPt NFC

Nick Desaulniers via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 12 09:51:08 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG1936bb81aafd: [ConstantHoisting] use BasicBlock::getFirstInsertionPt NFC (authored by nickdesaulniers).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154996/new/

https://reviews.llvm.org/D154996

Files:
  llvm/lib/Transforms/Scalar/ConstantHoisting.cpp


Index: llvm/lib/Transforms/Scalar/ConstantHoisting.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/ConstantHoisting.cpp
+++ llvm/lib/Transforms/Scalar/ConstantHoisting.cpp
@@ -323,12 +323,8 @@
 
   if (BFI) {
     findBestInsertionSet(*DT, *BFI, Entry, BBs);
-    for (auto *BB : BBs) {
-      BasicBlock::iterator InsertPt = BB->begin();
-      for (; isa<PHINode>(InsertPt) || InsertPt->isEHPad(); ++InsertPt)
-        ;
-      InsertPts.insert(&*InsertPt);
-    }
+    for (BasicBlock *BB : BBs)
+      InsertPts.insert(&*BB->getFirstInsertionPt());
     return InsertPts;
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154996.539612.patch
Type: text/x-patch
Size: 638 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230712/95529140/attachment.bin>


More information about the llvm-commits mailing list