From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 64242 invoked by alias); 14 Jun 2015 22:15:35 -0000 Mailing-List: contact jit-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Subscribe: Sender: jit-owner@gcc.gnu.org Received: (qmail 64190 invoked by uid 89); 14 Jun 2015 22:15:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.98.7 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=AWL,BAYES_40,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 X-Spam-Status: No, score=-0.6 required=5.0 tests=AWL,BAYES_40,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-HELO: mail-yh0-f43.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=jiRJ7db3QtOl80+BpTdo4cwls9zUN24KeHk2XI3z140=; b=OCN9eL7s9/tK0EFg4WwlwDzzTkDO/w8CExT5tliHBPHalFLdDjJ+HfIENtq/wgAHzT UpuH5Omx0eJUXIEjf4nf47wk304C+E75CtjccAIVx79QIYf2Fe0K+LmxvoM878BqXNrr wxwkYQOj/Gh6NeDPE3uv8lab378j7sZ+s2lwcJaGivcMCEGyo81I0JG1MlrzADOgAZ8k TD17JVxAG1gFZBSpDTF9Hb4crxaa2rILnFYOf2caMak7t+IHSGo++E6fbDXkhL5KCfup ctjaVPNnI+ntK54msboszAJVHULrDHZTukbbokYt1W0wwjnaFJraNRN4YB9g7qoRIktX I3zg== X-Gm-Message-State: ALoCoQm1c4TQHHDcxKelFGqhvWmXnf2atrnD+Jf8ODxXSNB3u+TKlB3l8gvjtjcu1DnVe8/pmnWX MIME-Version: 1.0 X-Received: by 10.129.39.21 with SMTP id n21mr15429209ywn.55.1434320128980; Sun, 14 Jun 2015 15:15:28 -0700 (PDT) In-Reply-To: References: Date: Thu, 01 Jan 2015 00:00:00 -0000 Message-ID: Subject: Re: Hit a showstopper issue From: Dibyendu Majumdar To: jit@gcc.gnu.org, David Malcolm Content-Type: text/plain; charset=UTF-8 X-SW-Source: 2015-q2/txt/msg00058.txt.bz2 I worked around this by patching my copy of gcc 5.1 - basically disabled the validation that checks for unreachable blocks. After that and some bug fixes and workarounds (see next post) it seems to work! On 14 June 2015 at 21:00, Dibyendu Majumdar wrote: > I have hit an issue that is a show stopper for me. > > In Lua, redundant bytecodes are emitted that end up being unreachable > blocks in the generated code. In LLVM these unreachable blocks are > simply eliminated during optimization. But libgccjit is failing with > an error. > > Here is a minimal Lua function. > > x=function() return; end > > The generated Lua bytecode is this: > > function (2 instructions at 0xad4840) > 0 params, 2 slots, 0 upvalues, 0 locals, 0 constants, 0 functions > 1 [1] RETURN 0 1 > 2 [1] RETURN 0 1 > constants (0) for 0xad4840: > locals (0) for 0xad4840: > upvalues (0) for 0xad4840: > > As you can see there is a redundant RETURN bytecode. > > The code I generate is this: > > static int > ravif1 (struct ravi_lua_State * L) > { > struct ravi_TValue * base; > > entry: > base = L->ci->u.l.base; > base = L->ci->u.l.base; > L->top = &base[(int)0]; > if ((struct ravi_LClosure *)L->ci->func->p->sizep > (int)0) goto > ; else goto ; > > : > (void)luaF_close (L, base); > goto ; > > : > (void)luaD_poscall (L, &base[(int)0]); > return (int)1; > > : > base = L->ci->u.l.base; > L->top = &base[(int)0]; > if ((struct ravi_LClosure *)L->ci->func->p->sizep > (int)0) goto > ; else goto ; > > : > (void)luaF_close (L, base); > goto ; > > : > (void)luaD_poscall (L, &base[(int)0]); > return (int)1; > } > > When this is compiled the following errors occur: > > libgccjit.so: error: unreachable block: > libgccjit.so: error: unreachable block: > libgccjit.so: error: unreachable block: