[llvm-dev] llvm.localsescape/recover

Carlo Kok via llvm-dev llvm-dev at lists.llvm.org
Tue Apr 3 04:53:42 PDT 2018


I 'm using locals recover to have a seh finally in a separate function:

  %1 = alloca i8*, align 4
  store i8* %0, i8** %1
  %2 = alloca i32
  store i32 0, i32* %2
call void (...) @llvm.localescape(i8** %1, i32* %2)

call my finaly like:

  %loctmp = call i8* @llvm.localaddress()
call void @"TEST$Fin0"(i8 0, i8* %loctmp)

and recover it with:

 %2 = call i8* @llvm.localrecover(i8* bitcast (void (i8*)* @TEST to i8*), i8* %1, i32 0)
  %3 = bitcast i8* %2 to i8**
%4 = load i8*, i8** %3

I get the right value passed to my original function (ie %1)

If I however *just* add a struct with 3 doubles alloca in it and localsescape those too:
  
  %3 = alloca %threedoubles
 store %threedoubles zeroinitializer, %threedoubles* %3
 call void (...) @llvm.localescape(i8** %1, i32* %2, %threedoubles* %3)

I get a different value (full testcase here)

https://gist.github.com/carlokok/e1c9aef9c8a382afdb280385a422f913

What am I doing wrong here?


More information about the llvm-dev mailing list