[llvm] [LoopIdiomVectorize] Remove redundant DomTreeUpdates (PR #94681)

Min-Yih Hsu via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 12 09:12:15 PDT 2024


================
@@ -679,7 +657,12 @@ void LoopIdiomVectorize::transformByteCompare(GetElementPtrInst *GEPA,
   BasicBlock *Header = CurLoop->getHeader();
   BranchInst *PHBranch = cast<BranchInst>(Preheader->getTerminator());
   IRBuilder<> Builder(PHBranch);
+
+  // Safeguard to check if we build the correct DomTree with DTU.
+  auto CheckDTU = llvm::make_scope_exit(
+      [this]() { assert(DT->verify() && "Ill-formed DomTree built by DTU"); });
----------------
mshockwave wrote:

DTU is declared after this `make_scope_exit` object, according C++ standard destructors will be invoked in the reverse of their declared order, so I believe this `make_scope_exit` callback is always called after `~DTU()`.

https://github.com/llvm/llvm-project/pull/94681


More information about the llvm-commits mailing list