[llvm] Extra assertions in RS4GC (PR #71201)

via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 21 12:57:32 PST 2023


================
@@ -1251,13 +1251,21 @@ static Value *findBasePointer(Value *I, DefiningValueMapTy &Cache,
   VerifyStates();
 #endif
 
+  // get the data layout to compare the sizes of base/derived pointer values
+  [[maybe_unused]] auto &DL =
+      cast<llvm::Instruction>(Def)->getModule()->getDataLayout();
   // Cache all of our results so we can cheaply reuse them
   // NOTE: This is actually two caches: one of the base defining value
   // relation and one of the base pointer relation!  FIXME
   for (auto Pair : States) {
     auto *BDV = Pair.first;
     Value *Base = Pair.second.getBaseValue();
     assert(BDV && Base);
+    // the assumption is that whenever we have a derived ptr(s), their base
----------------
annamthomas wrote:

```suggestion
    // Whenever we have a derived ptr(s), their base
```

https://github.com/llvm/llvm-project/pull/71201


More information about the llvm-commits mailing list