[llvm-dev] llvm.localsescape/recover

Carlo Kok via llvm-dev llvm-dev at lists.llvm.org
Thu Apr 5 04:50:17 PDT 2018


On Wed, Apr 4, 2018, at 10:42, Carlo Kok via llvm-dev wrote:
> 
> 
> On Wed, Apr 4, 2018, at 08:58, Carlo Kok via llvm-dev wrote:
> > That's quite likely.  I can reproduce this issue with llvm 6.0 though. 
> > I'll try with svn HEAD.
> > 
> > On Tue, Apr 3, 2018, at 19:22, Reid Kleckner wrote:
> > > I would guess that %threedoubles has a large alignment and that is making things go wrong. I thought we fixed this bug, though. I can't find it in the tracker, but it's in there. Someone used __try with local variables of type 'double' on 32-bit and things didn't work out. I'm pretty sure we fixed it though.
> > > 
> 


This pattern does work:

%1 = alloca <{ %Program**, %ThreeStructs* }>
  %15 = getelementptr <{ %Program**, i32*, %ThreeStructs* }>, <{ %Program**, %ThreeStructs* }>* %1, i32 0, i32 0, !dbg !62
  store %Program** %2, %Program*** %15, !dbg !62
%17 = getelementptr <{ %Program**, i32*, %ThreeStructs* }>, <{ %Program**, %ThreeStructs* }>* %1, i32 0, i32 1, !dbg !62
  store %ThreeStructs* %4, %ThreeStructs** %17, !dbg !62

...cleanuppad:
%28 = bitcast <{ %Program**,  %ThreeStructs* }>* %1 to i8*, !dbg !68
  call void @"mi_t1d_ConsoleApplication2_d_Program4_Test$Fin0"(i8 1, i8* %28) [ "funclet"(token %27) ], !dbg !68
...non eh cleanup:
%30 = bitcast <{ %Program**, %ThreeStructs* }>* %1 to i8*, !dbg !67
  call void @"mi_t1d_ConsoleApplication2_d_Program4_Test$Fin0"(i8 1, i8* %30), !dbg !67
    

define void @"mi_t1d_ConsoleApplication2_d_Program4_Test$Fin0"(i8, i8*) #3 comdat {
BasicBlock8:
  %2 = bitcast i8* %1 to <{ %Program**, i32*, %ThreeStructs* }>*, !dbg !68
  %3 = getelementptr <{ %Program**, i32*, %ThreeStructs* }>, <{ %Program**, i32*, %ThreeStructs* }>* %2, i32 0, i32 0, !dbg !68
  %4 = load %Program**, %Program*** %3, !dbg !68

So it's really the localsescape/restore that doesn't. I can work with this (though odds are it doesn't optimize as well) for now.


More information about the llvm-dev mailing list