Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tuleap 857] LLVM: use lslx/lsl1 & co #9

Open
vpalatin opened this issue May 27, 2019 · 0 comments
Open

[Tuleap 857] LLVM: use lslx/lsl1 & co #9

vpalatin opened this issue May 27, 2019 · 0 comments

Comments

@vpalatin
Copy link

@@ From Tuleap issue 857, submitted by jchauzi

There are some possible (simple) optimizations.
For example, (1 << n) - 1 = lslx -1 n (we gain one instruction, yeepee)

@JordiChauzi JordiChauzi transferred this issue from upmem/llvm Nov 4, 2019
JordiChauzi pushed a commit that referenced this issue Nov 27, 2019
Now use the immediate operand of the load/store instruction to store
the GlobalAddress/JumpTable/etc... symbol.

Fix #9
JordiChauzi pushed a commit that referenced this issue Aug 5, 2020
Now use the immediate operand of the load/store instruction to store
the GlobalAddress/JumpTable/etc... symbol.

Fix #9
JordiChauzi pushed a commit that referenced this issue Dec 4, 2020
Now use the immediate operand of the load/store instruction to store
the GlobalAddress/JumpTable/etc... symbol.

Fix #9
wwolff42 added a commit that referenced this issue Jul 29, 2024
…GE cleanup now ...

While at it, I implemented some quick optimization.

- Implemented `(1 << n) - 1` == `lslx lneg n`
#9

- Moved some 64-bit operation earlier in the pipeline,
from ResolveMacroInstrPass to expandPostRA.
I tried even earlier, but SUBC is not well defined and get moved around during MergeSink
for critical edge split. The computation is then wrong because require to be packed for the
particular use I identified.
I leave my experiment here. I will check to fully define it and move it preRA, or will leave it
like that again for a while, fulfilling my other duty.

- Fixed a few easy Def/Use when BuildMI

- Fixed lose of MachineInstr correctness
Our arithmetic+comp+branch was destroyed during analyzeBranch/removeBranch/insertBranch

- temporarily removed fusion of any instruction + JUMPi in MergeComboInstr
The problem is that at this stage (PreEmit):
- machine CFG is done.
- JUMPi is unconditional jump
- arithmetic + cond + branch; with cond as True/False is conditional
-- even if we know that cond with true/false is unconditional, the instruction have the
-- property of being conditional by its definition.
---- To fix that, I will create other PseudoInstruction to have them set correctly.
---- Also, if those arith+cond+branch do have pattern, maybe they could be selected far earlier
---- and the machine CFG would be correctly formed at the first place probably.

- issue with ThinLTO fixed
-- some code construction ended up in SELECTrr, which is not common for us
---- this is lowered to TmpJcc
---- and TmpJcc is kind of wrong
------ and finally, MergeComboInstr was combining even more wrong.
--> I removed TmpJcc, and use simply our well defined JEQrii

- issue whith ThinLTO fixed
-- another was present but undetected on Release build
-- we use multiple address spacees (IRAM, WRAM, MRAM)
-- there was an assertion with ThinLTO when populating GV out of multiple modules
---- it's fixed in llvm13, but we are on llvm12
------ I reproduced the patch (not cherry-picked) llvm@60c60dd
------ just for now. will do that correctly when cleaning up
------- so when I will upgrade our LLVM, it will be mergeable easily
wwolff42 added a commit that referenced this issue Jul 29, 2024
…GE cleanup now ...

While at it, I implemented some quick optimization.

- Implemented `(1 << n) - 1` == `lslx lneg n`
#9

- Moved some 64-bit operation earlier in the pipeline,
from ResolveMacroInstrPass to expandPostRA.
I tried even earlier, but SUBC is not well defined and get moved around during MergeSink
for critical edge split. The computation is then wrong because require to be packed for the
particular use I identified.
I leave my experiment here. I will check to fully define it and move it preRA, or will leave it
like that again for a while, fulfilling my other duty.

- Fixed a few easy Def/Use when BuildMI

- Fixed lose of MachineInstr correctness
Our arithmetic+comp+branch was destroyed during analyzeBranch/removeBranch/insertBranch

- temporarily removed fusion of any instruction + JUMPi in MergeComboInstr
The problem is that at this stage (PreEmit):
- machine CFG is done.
- JUMPi is unconditional jump
- arithmetic + cond + branch; with cond as True/False is conditional
-- even if we know that cond with true/false is unconditional, the instruction have the
-- property of being conditional by its definition.
---- To fix that, I will create other PseudoInstruction to have them set correctly.
---- Also, if those arith+cond+branch do have pattern, maybe they could be selected far earlier
---- and the machine CFG would be correctly formed at the first place probably.

- issue with ThinLTO fixed
-- some code construction ended up in SELECTrr, which is not common for us
---- this is lowered to TmpJcc
---- and TmpJcc is kind of wrong
------ and finally, MergeComboInstr was combining even more wrong.
--> I removed TmpJcc, and use simply our well defined JEQrii

- issue whith ThinLTO fixed
-- another was present but undetected on Release build
-- we use multiple address spacees (IRAM, WRAM, MRAM)
-- there was an assertion with ThinLTO when populating GV out of multiple modules
---- it's fixed in llvm13, but we are on llvm12
------ I reproduced the patch (not cherry-picked) llvm@60c60dd
------ just for now. will do that correctly when cleaning up
------- so when I will upgrade our LLVM, it will be mergeable easily
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

No branches or pull requests

1 participant