Skip to content

suboptimal code generation: integer ranges #11594

@llvmbot

Description

@llvmbot
Bugzilla Link 11222
Version trunk
OS All
Attachments First file: original test case, Second file: test case after opt -O3 -S
Reporter LLVM Bugzilla Contributor

Extended Description

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzilla

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions