Skip to content

Early CSE and GVN miss an assume optimization when the value isn't used directly #28460

@llvmbot

Description

@llvmbot
Bugzilla Link 28086
Version trunk
OS All
Attachments Minimum reproducing example
Reporter LLVM Bugzilla Contributor
CC @hfinkel

Extended Description

See https://groups.google.com/forum/#!topic/llvm-dev/90lQByG6teg for the conversation.

Here's a minimum reproducing example:

define i32 @​foo(i32*) {
entry:
%1 = load i32, i32* %0
%2 = icmp eq i32 %1, 3
call void @​llvm.assume(i1 %2)
%3 = load i32, i32* %0
ret i32 %3
}

Both -early-cse and -gvn independently simplify this IR to:

define i32 @​foo(i32*) {
entry:
%1 = load i32, i32* %0
ret i32 %1
}

Instead of:

define i32 @​foo(i32*) {
entry:
ret i32 3
}

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