[PATCH] [RewriteStatepointsForGC] Fix debug assertion during derivable pointer rematerialization
Sanjoy Das
sanjoy at playingwithpointers.com
Wed May 20 11:47:40 PDT 2015
LGTM with comments.
REPOSITORY
rL LLVM
================
Comment at: lib/Transforms/Scalar/RewriteStatepointsForGC.cpp:1947
@@ -1946,7 +1946,3 @@
#ifndef NDEBUG
- // Assert that cloned instruction does not use any instructions
- // other than LastClonedValue
- for (auto OpValue: ClonedValue->operand_values()) {
- if (isa<Instruction>(OpValue))
- assert(OpValue == LastClonedValue &&
- "unexpected use found in rematerialized value");
+ // Assert that cloned instruction does not use any instructions from
+ // this chain other than LastClonedValue
----------------
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);
```
http://reviews.llvm.org/D9882
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list