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

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 12 09:05:24 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"); });
----------------
david-arm wrote:

Given DTU only flushes when the object is destroyed at the end of the function can we guarantee that `DT->verify()` is called after the flush? Perhaps the answer is to do an explicit `flush()` at the end followed by the assert?

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


More information about the llvm-commits mailing list