[PATCH] D107574: [GlobalOpt] [MemoryBuiltins] Update getMallocType with bitcast on stored pointer

Shimin Cui via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 5 08:16:13 PDT 2021


scui created this revision.
scui added reviewers: efriedma, george.burgess.iv, vsk, fhahn.
Herald added a subscriber: hiraditya.
scui requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Currently, getMallocType checks the bitcast uses of the malloc call. If there is no bitcast uses of the malloc call, malloc function’s return type is returned. Sometimes, the bitcast is on the stored-to pointer instead of on the malloc call. This patch is to also consider the cases like this:

  %call = call i8* @malloc
  store i8* %call, i8** bitcast (%T** @g to i8**)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107574

Files:
  llvm/lib/Analysis/MemoryBuiltins.cpp
  llvm/test/Transforms/GlobalOpt/malloc-promote-5.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107574.364488.patch
Type: text/x-patch
Size: 3681 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210805/477805b6/attachment.bin>


More information about the llvm-commits mailing list