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

Chris B via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 8 09:06:50 PST 2023


================
@@ -1249,6 +1249,8 @@ static Value *findBasePointer(Value *I, DefiningValueMapTy &Cache,
 
 #ifndef NDEBUG
   VerifyStates();
+  // get the data layout to compare the sizes of base/derived pointer values
+  auto &DL = cast<llvm::Instruction>(Def)->getModule()->getDataLayout();
----------------
llvm-beanz wrote:

It might be better to move this outside the `ifndef` block and mark it as `[[maybe_unused]]`. It should get optimized away if it isn't used, and it would avoid the possibility of someone seeing it used in the assert and accidentally using it later in the function.

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


More information about the llvm-commits mailing list