From b86ddfdb9a80f2343510e07209ceda59d72972e3 Mon Sep 17 00:00:00 2001 From: Philip Reames Date: Wed, 14 Jul 2021 13:19:48 -0700 Subject: [PATCH] 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. --- llvm/lib/IR/Value.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/llvm/lib/IR/Value.cpp b/llvm/lib/IR/Value.cpp index 9cb0056..1c59565 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; -- 2.7.4