Correct assertion would be that there is no other uses from chain we are currently cloning. It is ok to have other uses of values not from this chain.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
LGTM with comments.
lib/Transforms/Scalar/RewriteStatepointsForGC.cpp | ||
---|---|---|
1947 ↗ | (On Diff #26155) | IIUC, the invariant that is interesting to check here is: before the replaceUsesOfWith call, ClonedValue uses exactly one of the values in ChainToBase and that value is LastValue. Is there a way you can rewrite the assert to check that instead? Basically, before ClonedValue->replaceUsesOfWith, have something like: for (auto OpValue : ...) { if(find(ChainToBase.begin(), .end(), OpValue)) assert(OpValue == LastValue); |
lib/Transforms/Scalar/RewriteStatepointsForGC.cpp | ||
---|---|---|
1947 ↗ | (On Diff #26155) | Actually a slightly stronger invariant can be enforced by: bool FoundLastValue = false; for (auto OpValue : ...) { if(find(ChainToBase.begin(), .end(), OpValue)) { assert(OpValue == LastValue); FoundLastValue = true; } assert(FoundLastValue); |