[PATCH] D58589: [ConstantHoisting] Call releaseMemory() to avoid dangling elements in ConstIntInfoVec

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 23 23:04:32 PST 2019


MaskRay created this revision.
MaskRay added reviewers: ormris, zzheng, dmgreen, wmi.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

ConstIntInfoVec contains elements extracted from the previous function.
In new PM, releaseMemory() is not called and the dangling elements can
cause segfault in findConstantInsertionPoint.


Repository:
  rL LLVM

https://reviews.llvm.org/D58589

Files:
  lib/Transforms/Scalar/ConstantHoisting.cpp
  test/Transforms/ConstantHoisting/X86/phi.ll


Index: test/Transforms/ConstantHoisting/X86/phi.ll
===================================================================
--- test/Transforms/ConstantHoisting/X86/phi.ll
+++ test/Transforms/ConstantHoisting/X86/phi.ll
@@ -1,4 +1,5 @@
 ; RUN: opt -S -consthoist < %s | FileCheck %s
+; RUN: opt -S -passes=consthoist < %s | FileCheck %s
 
 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-apple-macosx10.9.0"
Index: lib/Transforms/Scalar/ConstantHoisting.cpp
===================================================================
--- lib/Transforms/Scalar/ConstantHoisting.cpp
+++ lib/Transforms/Scalar/ConstantHoisting.cpp
@@ -947,6 +947,8 @@
   // Cleanup dead instructions.
   deleteDeadCastInst();
 
+  releaseMemory();
+
   return MadeChange;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58589.188071.patch
Type: text/x-patch
Size: 781 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190224/e7b4a971/attachment.bin>


More information about the llvm-commits mailing list