[llvm] 88ea86c - [Attributor][FIX] Remove reference into map that might dangle

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 17 15:42:55 PDT 2022


Author: Johannes Doerfert
Date: 2022-03-17T17:42:32-05:00
New Revision: 88ea86c369f3faecfd20db27d5e7b3424051f976

URL: https://github.com/llvm/llvm-project/commit/88ea86c369f3faecfd20db27d5e7b3424051f976
DIFF: https://github.com/llvm/llvm-project/commit/88ea86c369f3faecfd20db27d5e7b3424051f976.diff

LOG: [Attributor][FIX] Remove reference into map that might dangle

The reference was taken and the map was modified after. This can (and
did) lead to dangling pointers and all sorts of problems afterwards.

Added: 
    

Modified: 
    llvm/lib/Transforms/IPO/AttributorAttributes.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index e9257ad28039b..a2d50093aeb86 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -1344,7 +1344,7 @@ struct AAPointerInfoFloating : public AAPointerInfoImpl {
     DenseMap<Value *, OffsetInfo> OffsetInfoMap;
     OffsetInfoMap[&AssociatedValue] = OffsetInfo{0};
 
-    auto HandlePassthroughUser = [&](Value *Usr, OffsetInfo &PtrOI,
+    auto HandlePassthroughUser = [&](Value *Usr, OffsetInfo PtrOI,
                                      bool &Follow) {
       OffsetInfo &UsrOI = OffsetInfoMap[Usr];
       UsrOI = PtrOI;


        


More information about the llvm-commits mailing list