From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 263295771B4; Mon, 9 Oct 2023 12:32:05 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 263295771B4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1696843925; bh=LZUJryobcBb/rX2oK6zUA/QGkXKgc4GN4R7/7PMERCs=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=sPjmnYDd9op6i0Vs9yACOqbsQ0YaRRtOi62IWJI3nKTnp3MBxiGD6kD6eY3OmkiJQ mDd9xqS75SO09QeMyCkjb5gprhu+RV52iwjENXccUVFuqNQ0Pk3RVsYgTdySoNU3ia N4CWPS+dxHuQwpdMQSrPgFvZUTcp8wuRIBD37RV0= Received: from smtpng3.i.mail.ru (smtpng3.i.mail.ru [94.100.177.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 3D77D5771B4 for ; Mon, 9 Oct 2023 12:32:04 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 3D77D5771B4 Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1qpmcN-0000hg-E0; Mon, 09 Oct 2023 12:32:03 +0300 Date: Mon, 9 Oct 2023 12:27:35 +0300 To: Maxim Kokryashkin Message-ID: References: <20231003133705.5700-1-max.kokryashkin@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 78E4E2B564C1792B X-77F55803: 4F1203BC0FB41BD9FE0487E50246814664B90E63E64C84A86C37D3F160D6789200894C459B0CD1B989BDA8A25D849B3E284EE7A1CC3EC5E479AF37A0DD366D93128E90E6EA85A331 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE720512D700D076E85EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063729381D024F10DD158638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D867CE1D4CD47DCACF9D144D42E4B3F134117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC1BE95B8C87527B4BA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F44604297287769387670735201E561CDFBCA1751FBDFBBEFFF4125B51D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B696C29A01F2EA398E089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-C1DE0DAB: 0D63561A33F958A5A87D1396CFCBEF295339854CFAFAB789D01302A112F6135AF87CCE6106E1FC07E67D4AC08A07B9B0DB8A315C1FF4794DBDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0ADBF74143AD284FC7177DD89D51EBB7742424CF958EAFF5D571004E42C50DC4CA955A7F0CF078B5EC49A30900B95165D343FB425EC7F4D4A4B1EE7C43425E37D90FCF3D3AC43782FCC21C3B04C35C9B473E65C9DD55B5DD56C1D7E09C32AA3244C014D4A1A90CE623BC0E98B1EBAF5BCF5B038C9161EF167A1BAD658CF5C8AB4025DA084F8E80FEBD3202CD0F03380D9577A83BD0C44CE203720ABEDE4BBDD9CDD X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojEbds4VBqihReiN7JkBTmxg== X-DA7885C5: ED77C5F582D4A6A69A9FA1200DDBF6064FFE95ACA567F559D5D7D27E698387BD262E2D401490A4A0DB037EFA58388B346E8BC1A9835FDE71 X-Mailru-Sender: 689FA8AB762F73930F533AC2B33E986BA4CB6F926766B2697C556EA7A8AC6FAC0FBE9A32752B8C9C2AA642CC12EC09F1FB559BB5D741EB962F61BD320559CF1EFD657A8799238ED55FEEDEB644C299C0ED14614B50AE0675 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit v2] Mark CONV as non-weak, to prevent elimination of its side-effect. X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Sergey Kaplun via Tarantool-patches Reply-To: Sergey Kaplun Cc: Maksim Kokryashkin , tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi, Maxim! Thanks for the patch! LGTM, just a minor nit below. On 06.10.23, Maxim Kokryashkin wrote: > > > +-- Before the patch, the `0022 > int CONV 0017 int.num` > > I see that IR "0022 > int CONV ..." is present in both IR traces... > Yep, they are omitted due to DCE and it happens on the trace assembly > stage. Dropped a comment. > > > +-- instruction is omitted due to DCE, which results in the > > > +-- third side exit being taken, instead of the second, > > > +-- and, hence, incorrect summation. After the patch, `CONV` > > > +-- is left intact and is not omitted; it remains as a guarded > > > +-- instruction, so the second side exit is taken and sum is > > > +-- performed correctly. > > > + > > > +for _, val in ipairs(data) do > > > + if val == val then > > > + sum = sum + val > > > + end > > > +end > Here is the diff with changes. Branch is force-pushed: > === > diff --git a/test/tarantool-tests/mark-conv-non-weak.test.lua b/test/tarantool-tests/mark-conv-non-weak.test.lua > index f54f30ba..b71be4da 100644 > --- a/test/tarantool-tests/mark-conv-non-weak.test.lua > +++ b/test/tarantool-tests/mark-conv-non-weak.test.lua > @@ -4,11 +4,13 @@ local test = tap.test('mark-conv-non-weak'):skipcond({ > }) > > test:plan(1) > +-- XXX: These values were chosen to create type instability > +-- in the loop-carried dependency, so the checked `CONV int.num` > +-- instruction is emitted. See `loop_unrool` in `lj_opt_loop.c`. > +local data = {0, 0.1, 0, 0 / 0} > +local sum = 0.1 Do we really need to start the sum from 0.1, why just not 0? > > -local data = {0.1, 0, 0.1, 0, 0 / 0} > -local sum = 0 > - > -jit.opt.start('hotloop=2', 'hotexit=2') > +jit.opt.start('hotloop=1') > > -- XXX: The test fails before the patch only > -- for `DUALNUM` mode. All of the IRs below are > @@ -104,6 +106,9 @@ jit.opt.start('hotloop=2', 'hotexit=2') -- Best regards, Sergey Kaplun