• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

llir / llvm / 1171 / 1
63%
master: 63%

Build:
DEFAULT BRANCH: master
Ran 08 Jan 2020 09:00PM UTC
Files 83
Run time 7s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

08 Jan 2020 08:52PM UTC coverage: 66.965% (+0.1%) from 66.828%
1171.1

push

travis-ci

web-flow
ir/constant: output int const in hex notation if more readable (#126)

* ir/constant: add test case for hex vs. decimal integer notation

Updates #125.

* ir/constant: output int const in hex notation if more readable

To improve readability of integer constants in LLVM IR output, a notion
of "low entropy" is used to determine whether to output integer
constants in decimal or hexadecimal notation.

The main idea is to check how many unique digits are required for each
representation and use the notation (hex or decimal) that requires the
least.

To illustrate this idea, here are a few examples from before and after
this commit.

Before: 2147483648
After:  u0x80000000

Before: 9218868437227405312
After:  u0x7FF0000000000000

For now, we have a threshold at 1000, so integer constants below 1000
are always represented in decimal notation. This includes negative
integer values.

Fixes #125.

* ir/constant: refine notion of entropy to unique_digits/total_digits

Prior to this commit, the length of an integer constant was not
considered when computing its entropy. Thus long hexadecimal literals
got an unfair advantage as each of their digits contained more
information than their decimal counterpart.

The new definition of entropy is always in range (0.0, 1.0]. That is,
it is always above 0.0 and below or equal to 1.0.

Also, refine lower threshold to 0x1000 (instead of 1000).

If decimal notation require 0.3 or more entropy than hex notation, then
we output in hex.

* ir/constant: cap length by base when computing entropy

Without this fix, longer integer constants would get lower entropy even
though they may contain a lot of different digits.

For instance, the integer constant 1234567890 would get 1.0 as entropy,
while 12345678901234567890 would get 0.5 (since it contains every
digit, 10 and has a length of 20).

With this fix 12345678901234567890 has entropy 1.0, as should be, since
length is now capp... (continued)

9211 of 13755 relevant lines covered (66.96%)

33510.46 hits per line

Source Files on job 1171.1
  • Tree
  • List 0
  • Changed 2
  • Source Changed 1
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 1075
  • Travis Job 1171.1
  • d460b72b on github
  • Prev Job for on master (#1163.1)
  • Next Job for on master (#1172.1)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc