[llvm] b86ddfd - Global variables with strong definitions cannot be freed

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 14 13:26:32 PDT 2021


Author: Philip Reames
Date: 2021-07-14T13:26:18-07:00
New Revision: b86ddfdb9a80f2343510e07209ceda59d72972e3

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

LOG: Global variables with strong definitions cannot be freed

With the current deref semantics, this is redundant - since we assume that anything which is dereferenceable (ever) can't be freed - but it becomes neccessary for the deref-at-point semantics.

Testing wise, this is covered by test/CodeGen/X86/hoist-invariant-load.ll when -use-dereferenceable-at-point-semantics is active.  I didn't bother duplicating the command line since a) it's an in-development mode, and b) the change is pretty obvious.

Added: 
    

Modified: 
    llvm/lib/IR/Value.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/Value.cpp b/llvm/lib/IR/Value.cpp
index 9cb00569598a..1c595651b3d7 100644
--- a/llvm/lib/IR/Value.cpp
+++ b/llvm/lib/IR/Value.cpp
@@ -897,6 +897,7 @@ uint64_t Value::getPointerDereferenceableBytes(const DataLayout &DL,
       // CanBeNull flag.
       DerefBytes = DL.getTypeStoreSize(GV->getValueType()).getFixedSize();
       CanBeNull = false;
+      CanBeFreed = false;
     }
   }
   return DerefBytes;


        


More information about the llvm-commits mailing list