http://llvm.org/bugs/show_bug.cgi?id=16380

            Bug ID: 16380
           Summary: Missed optimization opportunities for pointer
                    comparisons
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

Given "p" as an object of type pointer-to-T and "x" as a complete object of
type T, the C++ standard defines the following expressions must either yield
"false" or an unspecified result:

    p < nullptr
    nullptr < p
    p < &x
    &x+1 < p

Thus, the compiler is free to constant fold these expressions to just "false",
and should do so.  Similarly, if "a < b" folds to "false" by matching a pattern
above, "b > a" should also fold to "false", and "a >= b" and "b <= a" should
fold to "true".

Currently, Clang only constant folds the first pattern.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to