Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

suboptimal code generation: integer ranges #11407

Open Quuxplusone opened 12 years ago

Quuxplusone commented 12 years ago
Bugzilla Link PR11222
Status NEW
Importance P normal
Reported by s3734770@mail.zih.tu-dresden.de
Reported on 2011-10-24 02:10:04 -0700
Last modified on 2011-10-24 03:34:56 -0700
Version trunk
Hardware All All
CC baldrick@free.fr, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments y.ll (8814 bytes, application/octet-stream)
z.ll (6584 bytes, application/octet-stream)
Blocks
Blocked by
See also
Created attachment 7508
First file: original test case

I have a ParseInt function which is able to parse either a integer or a hex
string (beginning with $). While parsing integers and hex numbers is really
similar, i put them into one function.

The test case is compiled from the following program:
static init
begin
  var i: int = ParseInt('5', 0)
  print(IntToStr(i))
end

I attached a second file which is the run after opt -O3.
As you see in block vergleich.i in line 54, %testpx.i is compared wether it is
smaller than 10.
In gleich.i, %textpx.i is compared wether it is greater than 9. %gleich.i's
predecessor is %vergleich2.i which predecessor is %vergleich.i
But %vergleich.i only branches into vergleich2.i when %testpx.i is smaller than
10, so it can never become greater than 9.
Quuxplusone commented 12 years ago

Attached y.ll (8814 bytes, application/octet-stream): First file: original test case

Quuxplusone commented 12 years ago

Attached z.ll (6584 bytes, application/octet-stream): Second file: test case after opt -O3 -S