[llvm] [LoopIdiomVectorize] Remove redundant DomTreeUpdates (PR #94681)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 13 05:35:30 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:
OK thanks for explaining. Perhaps it's just me that didn't find this obvious, but I wonder if it would be useful to leave a brief comment explaining how this works? For example,
```
// Safeguard to check if we build the correct DomTree with DTU. In accordance
// with C++ rules, destructors are called in reverse order so the verify()
// occurs after ~DTU.
```
https://github.com/llvm/llvm-project/pull/94681
More information about the llvm-commits
mailing list