[mlir][Inliner] Store the resolved call by-value instead of by-reference
authorRiver Riddle <riddleriver@gmail.com>
Thu, 16 Apr 2020 00:41:31 +0000 (17:41 -0700)
committerRiver Riddle <riddleriver@gmail.com>
Thu, 16 Apr 2020 00:42:27 +0000 (17:42 -0700)
This avoids asan failures as more calls may be added during inlining, invalidating the reference.

Differential Revision: https://reviews.llvm.org/D78258

mlir/lib/Transforms/Inliner.cpp

index f797ca8..9826f5c 100644 (file)
@@ -455,7 +455,7 @@ inlineCallsInSCC(Inliner &inliner, CGUseList &useList,
   // here as more calls may be added during inlining.
   bool inlinedAnyCalls = false;
   for (unsigned i = 0; i != calls.size(); ++i) {
-    ResolvedCall &it = calls[i];
+    ResolvedCall it = calls[i];
     LLVM_DEBUG({
       llvm::dbgs() << "* Considering inlining call: ";
       it.call.dump();