[all-commits] [llvm/llvm-project] 8a567e: [ScalarEvolution] Fix pointer/int type handling co...

Eli Friedman via All-commits all-commits at lists.llvm.org
Thu Jun 17 14:05:41 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8a567e5f22a6d76ce076cf4305fe5c7cbff50fe0
      https://github.com/llvm/llvm-project/commit/8a567e5f22a6d76ce076cf4305fe5c7cbff50fe0
  Author: Eli Friedman <efriedma at quicinc.com>
  Date:   2021-06-17 (Thu, 17 Jun 2021)

  Changed paths:
    M llvm/lib/Analysis/ScalarEvolution.cpp
    M llvm/test/Analysis/ScalarEvolution/pr46786.ll
    M llvm/test/Transforms/IndVarSimplify/pr45835.ll
    M llvm/unittests/Transforms/Utils/ScalarEvolutionExpanderTest.cpp

  Log Message:
  -----------
  [ScalarEvolution] Fix pointer/int type handling converting select/phi to min/max.

The old version of this code would blindly perform arithmetic without
paying attention to whether the types involved were pointers or
integers.  This could lead to weird expressions like negating a pointer.

Explicitly handle simple cases involving pointers, like "x < y ? x : y".
In all other cases, coerce the operands of the comparison to integer
types.  This avoids the weird cases, while handling most of the
interesting cases.

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




More information about the All-commits mailing list