Skip to content

Provide input to LLVM's TBAA (type-based alias analysis) #2769

Open
@JohanEngelen

Description

@JohanEngelen

Currently we cannot optimize this code further:

int foo(int *x, float *y) {
  *x = 5;
  *y = 8.0f; // cannot alias with x because of types
  return *x; // here we reload from memory, instead of returning 5
}

Optimization is continued by Clang for C++ (i.e. returning 5 as immediate operand) using TBAA.
https://lists.llvm.org/pipermail/llvm-dev/2018-July/124493.html

This needs thorough checking: the notion that pointers of different types cannot alias must be added to the spec if it is not already in the spec. (note: int[] and int* and int[5]* can alias and can also partially alias)

This is not a minor task.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions