[all-commits] [llvm/llvm-project] afbb6d: [CVP] Simplify and generalize switch handling

Nikita Popov via All-commits all-commits at lists.llvm.org
Sat Dec 12 12:12:48 PST 2020


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: afbb6d97b501502b89bedc3da2a5d7ec00f56dba
      https://github.com/llvm/llvm-project/commit/afbb6d97b501502b89bedc3da2a5d7ec00f56dba
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2020-12-12 (Sat, 12 Dec 2020)

  Changed paths:
    M llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
    M llvm/test/Transforms/CorrelatedValuePropagation/basic.ll

  Log Message:
  -----------
  [CVP] Simplify and generalize switch handling

CVP currently handles switches by checking an equality predicate
on all edges from predecessor blocks. Of course, this can only
work if the value being switched over is defined in a different block.

Replace this implementation with a call to getPredicateAt(), which
also does the predecessor edge predicate check (if not defined in
the same block), but can also do quite a bit more: It can reason
about phi-nodes by checking edge predicates for incoming values,
it can reason about assumes, and it can reason about block values.

As such, this makes the implementation both simpler and more
powerful. The compile-time impact on CTMark is in the noise.




More information about the All-commits mailing list