Skip to content

False negative when inferring gep nuw on alloca #1138

@nikic

Description

@nikic

This verifies:

define ptr @src_alloca(i64 %x) {
  %p = alloca [128 x i8]
  %gep = getelementptr i8, ptr %p, i64 %x
  ret ptr %gep
}

define ptr @tgt_alloca(i64 %x) {
  %p = alloca [128 x i8]
  %gep = getelementptr nuw i8, ptr %p, i64 %x
  ret ptr %gep
}

The equivalent code with a global does correctly require inbounds on the original GEP.

https://alive2.llvm.org/ce/z/C6amHn

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions