Skip to content

Fix JIT symbol resolution for static const members with in-class initializers - #1

Closed
pfeodrippe wants to merge 1 commit into
jank-lang:jank-snapshot/llvm22from
pfeodrippe:jank-snapshot/llvm22
Closed

pfeodrippe wants to merge 1 commit into
jank-lang:jank-snapshot/llvm22from
pfeodrippe:jank-snapshot/llvm22

Conversation

@pfeodrippe

Copy link
Copy Markdown

From pfeodrippe#1 trying to resolve llvm#146956

@pfeodrippe
pfeodrippe marked this pull request as draft November 23, 2025 21:43
@jeaye jeaye closed this Feb 10, 2026
jeaye pushed a commit that referenced this pull request Sep 1, 2026
This PR optimizes the AArch64 backend for 128-bit integer squaring
(`u128 x * x`).

It updates the instruction selection logic to combine `(A + B) + B` into
`A + (B << 1)`. This allows the compiler to emit a single, optimal `add
... lsl #1` instruction instead of multiple separate `add` instructions.

A baseline test was added in the first commit, and the optimization is
provided in the second commit to clearly highlight the codegen
improvements.

Fixes llvm#213775
jeaye pushed a commit that referenced this pull request Sep 1, 2026
This PR should fix ASAN errors from
https://lab.llvm.org/buildbot/#/builders/52/builds/19811

There are three sources of leaks:

1. TargetPassConfig not being `PM.add()`ed
```
   Direct leak of 136 byte(s) in 1 object(s) allocated from:
     #1 ...createPassConfig(...)      DirectXTargetMachine.cpp:216:10   <- return new DirectXPassConfig(*this, PM);
     #2 ...addPassesToEmitFile(...)   DirectXTargetMachine.cpp:177:34   <- TargetPassConfig *PassConfig = createPassConfig(PM);
   Indirect leak of 144 byte(s) in 1 object(s) allocated from:
     #1 llvm::TargetPassConfig::TargetPassConfig(...)  TargetPassConfig.cpp:604:10  <- Impl = new PassConfigImpl();
     #2 DirectXPassConfig                              DirectXTargetMachine.cpp:112:9
 ```
 
2. MachineModuleInfoWrapperPass not being `PM.add()`ed
```
   Direct leak of 2624 byte(s) in 1 object(s) allocated from:
#1 compileModule(...) llc.cpp:786:9 <- new
MachineModuleInfoWrapperPass(Target.get());
...passed in at llc.cpp:842:19, then dropped unless the
obj+complete-pipeline branch ran
 ```
 
3. Orphaned GlobalVariables that were detached from the module but got
never deleted:
- llvm/lib/Target/DirectX/DXILCBufferAccess.cpp:44:
`Global->removeFromParent()`;
- llvm/lib/Target/DirectX/DXILOpLowering.cpp:277:
`NameGlobal->removeFromParent()`;
 
```
   opt -S -dxil-cbuffer-access ... CBufferAccess/scalars.ll
     definitely lost: 57 bytes in 3 blocks      (3 name entries)
     indirectly lost: 384 bytes in 3 blocks     (3 × 128-byte GlobalVariable)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants