[PATCH] D35663: [Polly] Remove dependency of `Scop::getStmtFor(Inst)` on `getStmtFor(BB)`. [NFC].

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 20 13:14:17 PDT 2017


Meinersbur added inline comments.


================
Comment at: lib/Analysis/ScopInfo.cpp:4829-4830
+  for (Instruction &Inst : *BB) {
+    assert(!InstStmtMap[&Inst] &&
+           "Unexpected statement corresponding to the instruction.");
+    InstStmtMap[&Inst] = Stmt;
----------------
[Serious] `InstStmtMap[&Inst]` modifies the map inside an assert statement. Such side-effects may cause Polly to behave differently in debug than in release builds. While currently the element is added anyway, some future change may add the element only under some condition and forget this assert that still adds it. It is good practice to avoid side-effects in asserts in the first place.

Please use `InstStmtMap.count(&Inst)` instead.


https://reviews.llvm.org/D35663





More information about the llvm-commits mailing list