[PATCH] D84031: Clear NewGEPBases after finish using them in CodeGenPrep pass

Yichao Yu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 17 08:16:14 PDT 2020


yuyichao created this revision.
yuyichao added a reviewer: t.p.northover.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

AFAICT all other set/map are correctly cleared in `runOnFunction`.

With assertion enabled this causes a crash when the module is freed and potentially if a later pass delete the instruction (not observed in real world though). Without assertion this can potentially cause confusing result when running on a new Function/Module.


https://reviews.llvm.org/D84031

Files:
  llvm/lib/CodeGen/CodeGenPrepare.cpp


Index: llvm/lib/CodeGen/CodeGenPrepare.cpp
===================================================================
--- llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -540,6 +540,7 @@
     LargeOffsetGEPID.clear();
   }
 
+  NewGEPBases.clear();
   SunkAddrs.clear();
 
   if (!DisableBranchOpts) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84031.278763.patch
Type: text/x-patch
Size: 326 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200717/bf08185d/attachment.bin>


More information about the llvm-commits mailing list