Frank Winter via llvm-dev
2021-Oct-29 16:56 UTC
[llvm-dev] mem2reg not working in this case?
I can't get the alloca in attached function to be promoted to (a) register(s). I try with opt -mem2reg < module_eval0.ll but the output is unchanged. Using LLVM 13 release. Can anyone see why it's not working? Is this too complicated for mem2reg? The alloca is moved to the beginning.. is this the problem? Frank -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20211029/f192c13a/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: module_eval0.ll Type: application/octet-stream Size: 2784 bytes Desc: module_eval0.ll URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20211029/f192c13a/attachment.obj>
Johannes Doerfert via llvm-dev
2021-Oct-31 16:07 UTC
[llvm-dev] mem2reg not working in this case?
While this doesn't answer your question it might still solve your problem: opt -sroa < module_eval0.ll ~ Johannes On 10/29/21 11:56, Frank Winter via llvm-dev wrote:> I can't get the alloca in attached function to be promoted to (a) register(s). > > I try with > > opt -mem2reg < module_eval0.ll > > but the output is unchanged. Using LLVM 13 release. > > Can anyone see why it's not working? Is this too complicated for mem2reg? The alloca is moved to the beginning.. is this the problem? > > Frank > > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Chris Lattner via llvm-dev
2021-Oct-31 18:59 UTC
[llvm-dev] mem2reg not working in this case?
> On Oct 29, 2021, at 9:56 AM, Frank Winter via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > I can't get the alloca in attached function to be promoted to (a) register(s). > > I try with > > opt -mem2reg < module_eval0.ll > > but the output is unchanged. Using LLVM 13 release. > > Can anyone see why it's not working? Is this too complicated for mem2reg? The alloca is moved to the beginning.. is this the problem?Mem2reg only supports trivial loads and stores of the alloca. These noop GEP operations are blocking it: %14 = getelementptr float, float* %0, i32 0 I’d recommend changing your frontend to not generate them. -Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20211031/8ae48138/attachment.html>