[llvm] [SandboxVec][DAG] Implement PredIterator (PR #111604)

via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 10 11:14:00 PDT 2024


================
@@ -8,10 +8,45 @@
 
 #include "llvm/Transforms/Vectorize/SandboxVectorizer/DependencyGraph.h"
 #include "llvm/ADT/ArrayRef.h"
+#include "llvm/SandboxIR/Instruction.h"
 #include "llvm/SandboxIR/Utils.h"
 
 namespace llvm::sandboxir {
 
+PredIterator::value_type PredIterator::operator*() {
+  // If it's a DGNode, or a MemDGNode with an OpIt != end.
+  if (!isa<MemDGNode>(N) || OpIt != OpItE) {
+    assert(OpIt != OpItE && "Can't dereference end iterator!");
----------------
vporpo wrote:

If it's a DGNode then the `OpIt != OpItE` check doesn't even get executed, it steps right inside the if body.


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


More information about the llvm-commits mailing list