Bug 23774 – [REG 2.103-beta] cannot inline function `core.bitop.Split64.this`

Status
NEW
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86
OS
All
Creation time
2023-03-11T16:49:58Z
Last change time
2024-12-13T19:27:44Z
Assigned to
No Owner
Creator
Rainer Schuetze
Moved to GitHub: dmd#20246 →

Comments

Comment #0 by r.sagitario — 2023-03-11T16:49:58Z
Compiling ``` import core.bitop; int foo(ulong x) { return bsr(x); } ``` with `dmd -c -m32 -inline -wi" produces: /dlang/dmd-beta/linux/bin64/../../src/druntime/import/core/bitop.d(45): Warning: cannot inline function `core.bitop.Split64.this` The assembly shows that the ctor is indeed not inlined.
Comment #1 by maxhaton — 2023-03-12T23:53:09Z
Part of the wtf is warning on inline failure by default. dmd's IR seems to make some kind of inlining basically impossible in practice. The transformation is mathematically possible but has not been implemented (for such a fundamental concept as inlining)
Comment #2 by r.sagitario — 2023-03-13T06:20:39Z
Something changed about the `__ctfe` branch in ``` union Split64 { ulong u64; uint lo; pragma(inline, true) this(ulong u64) { if (__ctfe) lo = cast(uint) u64; else this.u64 = u64; } } int foo(ulong v) { const sv = Split64(v); return (sv.lo == 0); } ``` If you replace `__ctfe` with `false` the wwarning disappears.
Comment #3 by robert.schadek — 2024-12-13T19:27:44Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20246 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB