[all-commits] [llvm/llvm-project] 499f1c: [GlobalOpt] Use generic type when converting mallo...
Nikita Popov via All-commits
all-commits at lists.llvm.org
Mon Jan 17 00:55:50 PST 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 499f1ca79f232faae09b1793a994d1a22ba403cd
https://github.com/llvm/llvm-project/commit/499f1ca79f232faae09b1793a994d1a22ba403cd
Author: Nikita Popov <npopov at redhat.com>
Date: 2022-01-17 (Mon, 17 Jan 2022)
Changed paths:
M llvm/lib/Transforms/IPO/GlobalOpt.cpp
M llvm/test/Transforms/GlobalOpt/2021-08-03-StoreOnceLoadMultiCasts.ll
M llvm/test/Transforms/GlobalOpt/malloc-promote-5.ll
A llvm/test/Transforms/GlobalOpt/malloc-promote-opaque-ptr.ll
Log Message:
-----------
[GlobalOpt] Use generic type when converting malloc to global
The malloc to global transform currently determines the type of the
global by looking at bitcasts of the malloc. This is limited (the
transform fails if there are multiple different types) and
incompatible with opaque pointers.
My initial approach was to construct an appropriate struct type
based on usage in loads/stores. What this patch does instead is
to always create an [i8 x AllocSize] global, without trying to
guess types at all.
This does mean that other transforms that require a certain global
type may break. I fixed two of these in D117034 and D117223, which
I believe should be sufficient to avoid regressions. In particular,
the global SRA change should end up splitting the global into
naturally-typed sub-globals, at which point all other optimizations
should work.
Differential Revision: https://reviews.llvm.org/D117092
More information about the All-commits
mailing list