Skip to content

Predicates should handle poison #39

@davemenendez

Description

@davemenendez

Alive newsema accepts this optimization:

Pre: isPowerOf2(%a)
  %a = shl i4 1, %x
  %b = select 1, %x, %a
  %c = icmp ult %b, 4
=>
  %c = true

See also http://rise4fun.com/Alive/U4o

LLVM's isKnownToBeAPowerOfTwo analysis is always true for %a, no matter what is known about %x. In other words, the precondition should not constrain %x at all. This is allowed by LLVM because the analysis is not required to be accurate when its input is poison, which it will be in any case where the optimization is not a refinement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions