[all-commits] [llvm/llvm-project] 8b0d76: [DFAJumpThreading] Relax analysis to handle unpred...

Alexey Z. via All-commits all-commits at lists.llvm.org
Thu May 26 08:31:24 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8b0d7634743965948234b666c77393d4dd8535d7
      https://github.com/llvm/llvm-project/commit/8b0d7634743965948234b666c77393d4dd8535d7
  Author: Alex Zhikhartsev <alex.zhi at huawei.com>
  Date:   2022-05-26 (Thu, 26 May 2022)

  Changed paths:
    M llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp
    M llvm/test/Transforms/DFAJumpThreading/dfa-jump-threading-analysis.ll
    M llvm/test/Transforms/DFAJumpThreading/negative.ll

  Log Message:
  -----------
  [DFAJumpThreading] Relax analysis to handle unpredictable initial values

Responding to a feature request from the Rust community:

https://github.com/rust-lang/rust/issues/80630

    void foo(X) {
      for (...)
	switch (X)
	  case A
	    X = B
	  case B
	    X = C
    }

Even though the initial switch value is non-constant, the switch
statement can still be threaded: the initial value will hit the switch
statement but the rest of the state changes will proceed by jumping
unconditionally.

The early predictability check is relaxed to allow unpredictable values
anywhere, but later, after the paths through the switch statement have
been enumerated, no non-constant state values are allowed along the
paths. Any state value not along a path will be an initial switch value,
which can be safely ignored.

Differential Revision: https://reviews.llvm.org/D124394




More information about the All-commits mailing list