Skip to content

Update to clang-503.0.38 #10

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

Closed
mbazaliy opened this issue May 7, 2014 · 1 comment
Closed

Update to clang-503.0.38 #10

mbazaliy opened this issue May 7, 2014 · 1 comment

Comments

@mbazaliy
Copy link

mbazaliy commented May 7, 2014

Apple open sourced a new version of clang, any plans to update current branch ?

http://www.opensource.apple.com/source/clang/clang-503.0.38/

@cryptopathe
Copy link
Collaborator

Yes, definitely. We also have a set of new patches almost ready to be pushed. It is a matter of two-three weeks.

hudjefa referenced this issue in hudjefa/obfuscator-llvm Feb 14, 2022
This patch implemented TTI.IntImmCost() properly.
Each BPF insn has 32bit immediate space, so for any immediate
which can be represented as 32bit signed int, the cost
is technically free. If an int cannot be presented as
a 32bit signed int, a ld_imm64 instruction is needed
and a TCC_Basic is returned.

This change is motivated when we observed that
several bpf selftests failed with latest llvm trunk, e.g.,
  heroims#10/16 strobemeta.o:FAIL
  heroims#10/17 strobemeta_nounroll1.o:FAIL
  heroims#10/18 strobemeta_nounroll2.o:FAIL
  heroims#10/19 strobemeta_subprogs.o:FAIL
  obfuscator-llvm#96 snprintf_btf:FAIL

The reason of the failure is due to that
SpeculateAroundPHIsPass did aggressive transformation
which alters control flow for which currently verifer
cannot handle well. In llvm12, SpeculateAroundPHIsPass
is not called.

SpeculateAroundPHIsPass relied on TTI.getIntImmCost()
and TTI.getIntImmCostInst() for profitability
analysis. This patch implemented TTI.getIntImmCost()
properly for BPF backend which also prevented
transformation which caused the above test failures.

Differential Revision: https://reviews.llvm.org/D96448

(cherry picked from commit a260ae716030d5d2644a2af649501277d326bb21)
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

2 participants