[LLVMbugs] [Bug 17925] New: Broken transitivity in functions comparison in MergeFunction pass
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Nov 14 04:25:36 PST 2013
http://llvm.org/bugs/show_bug.cgi?id=17925
Bug ID: 17925
Summary: Broken transitivity in functions comparison in
MergeFunction pass
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Transformation Utilities
Assignee: unassignedbugs at nondot.org
Reporter: stpworld at narod.ru
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Created attachment 11539
--> http://llvm.org/bugs/attachment.cgi?id=11539&action=edit
Fix
This issue is about case of treating pointers as integers.
We treat pointers as different if they references different address space. At
the same time, we treat pointers equal to integers (with machine address
width).
Its a point of false-positive now. Consider next case on 32bit machine:
void foo0(i32 addrespace(1)* %p)
void foo1(i32 addrespace(2)* %p)
void foo2(i32 %p)
foo0 != foo1, while
foo1 == foo2 and foo0 == foo2.
As you can see it breaks transitivity. That means that result depends on order
of how functions are presented in module. Next order causes merging of foo0 and
foo1:
foo2, foo0, foo1
First foo0 will be merged with foo2, foo0 will be erased. Second foo1 will be
merged with foo2.
Depending on order things could be merged we don't expect to.
The fix:
The are cases when we CAN treat pointers as integers, and places when we CAN'T.
Below is my proposal:
* We treat pointers as integers when we compare function formal arguments.
* Otherwise, we can't do that in general.
* We can add more exceptions, where address space affects nothing: for example
argument of "ret" instruction.
The patch is attached.
Though, by now, it breaks 3 tests, but only since these tests checks things
that are wrong in general.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20131114/00735695/attachment.html>
More information about the llvm-bugs
mailing list