Skip to content

Align attribute doesn't imply dereferenceability #90446

Open
@nunoplopes

Description

@nunoplopes

InstCombine does the following propagation of align(32) in the function argument to the load.
However these align have different semantics. Align in load/store imply dereferenceability of the size rounded up to the alignment (per LangRef). Align in a function argument does not.

define i32 @foo2(ptr align(32) %a) {
  %#0 = load i32, ptr %a, align 4
  ret i32 %#0
}
=>
define i32 @foo2(ptr align(32) %a) {
  %#0 = load i32, ptr align(32) %a, align 32
  ret i32 %#0
}
Transformation doesn't verify! (unsound)
ERROR: Source is more defined than target

Example:
ptr align(32) %a = pointer(non-local, block_id=1, offset=0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    llvm:instcombineCovers the InstCombine, InstSimplify and AggressiveInstCombine passesmiscompilation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions