[llvm] a248eca - Clear NewGEPBases after finish using them in CodeGenPrep pass

Yichao Yu via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 24 09:12:22 PST 2020


Author: Yichao Yu
Date: 2020-11-24T12:12:00-05:00
New Revision: a248eca6659779116a6fb348117d74a0b8a05316

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

LOG: Clear NewGEPBases after finish using them in CodeGenPrep pass

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.

Reviewed By: loladiro

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

Added: 
    

Modified: 
    llvm/lib/CodeGen/CodeGenPrepare.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index 4ddfe0ad48c7..40e92b9e0a4a 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -544,6 +544,7 @@ bool CodeGenPrepare::runOnFunction(Function &F) {
     LargeOffsetGEPID.clear();
   }
 
+  NewGEPBases.clear();
   SunkAddrs.clear();
 
   if (!DisableBranchOpts) {


        


More information about the llvm-commits mailing list