[PATCH] D152022: [CodeGen] Add support for reductions in ComplexDeinterleaving pass

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 6 08:02:18 PDT 2023


fhahn added inline comments.
Herald added a subscriber: wangpc.


================
Comment at: llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp:1445
+  SmallVector<Instruction *> OperationInstruction;
+  for (auto &P : ReductionInfo)
+    OperationInstruction.push_back(P.first);
----------------
Iterating over `std::map<Instruction *, ...` here causes codegen non-determinism as the order depends on the memory addresses, so the order may different across different runs.  

I pushed a fix to use `MapVector` instead: https://github.com/llvm/llvm-project/commit/4c9223c77062bc93f63039c9ebdd885d0f50de59

Spotting such issues can be very difficult and we need to be careful when the iteration order can be non-deterministic 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D152022



More information about the llvm-commits mailing list