Verify that the incoming defs into phis are the last defs from the
respective incoming blocks.
When moving blocks, insertDef must RenameUses. Adding this verification
makes GVNHoist tests fail that uncovered this issue.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
Thanks for adding this!
just a code clarity nit. LGTM otherwise
lib/Analysis/MemorySSA.cpp | ||
---|---|---|
1873 ↗ | (On Diff #204128) | nit: IMO, the control-flow of this loop is a bit difficult to follow, and the verification it's doing about forwards-unreachable code are pretty understated. do you think something like the following is clearer (and functionally equivalent)? if (DT->getNode(Pred))) { auto *CurBB = Pred; while (CurBB) { if (/* getblockdefs(CurBB) */) { assert(LastAcc == IncAcc); break; } CurBB = IDom; } assert(CurBB || IncAcc == LOE && ...); } else if (/* getblockdefs(Pred) */) { assert(IncAcc == LastAcc); } else { assert(IncAcc == LOE); } |
lib/Analysis/MemorySSA.cpp | ||
---|---|---|
1873 ↗ | (On Diff #204128) | To me it seemed cleaner before, because I didn't need to duplicate the if (getblockdefs) and each of the two asserts. But perhaps it's clearer to duplicate, I have no strong preference TBH. |