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?
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. On Tue, Apr 3, 2018 at 4:53 AM Carlo Kok via llvm-dev < llvm-dev at lists.llvm.org> wrote:> 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? > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180403/8b4992bc/attachment.html>
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. > > On Tue, Apr 3, 2018 at 4:53 AM Carlo Kok via llvm-dev <llvm-dev at lists.llvm.org> wrote: >> 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? >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev