Skip to content

[CVP] Inappropriate folding with llvm.assume #90206

@YanWQ-monad

Description

@YanWQ-monad

For the IR

define i32 @src(i32 noundef %x) {
  %r = add i32 %x, -1
  %17 = icmp sgt i32 %r, -1
  tail call void @llvm.assume(i1 %17)
  ret i32 %r
}

CorrelatedValuePropagationPass will fold %17 to true from the knowledge of llvm.assume, which should be inappropriate, because it drops the information from llvm.assume after optimization:

define i32 @src(i32 noundef %x) {
  %r = add i32 %x, -1
  ret i32 %r
}

Link: https://godbolt.org/z/6q3zWcbjn

Metadata

Metadata

Assignees

No one assigned

    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