[all-commits] [llvm/llvm-project] 0bf75d: Handle the unexpected inputs for pass HardwareLoops

XinWang10 via All-commits all-commits at lists.llvm.org
Wed Mar 29 19:42:39 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0bf75d85419e87d3cb0352f7ebc8ef252869e9f6
      https://github.com/llvm/llvm-project/commit/0bf75d85419e87d3cb0352f7ebc8ef252869e9f6
  Author: Wang, Xin10 <xin10.wang at intel.com>
  Date:   2023-03-30 (Thu, 30 Mar 2023)

  Changed paths:
    M llvm/include/llvm/Analysis/TargetTransformInfo.h
    M llvm/lib/Analysis/TargetTransformInfo.cpp
    A llvm/test/Transforms/HardwareLoops/unexpected-inputs.ll

  Log Message:
  -----------
  Handle the unexpected inputs for pass HardwareLoops

For a function TryConvertLoop in pass HardwareLoops, wrong input arguments will
lead to crash. There will be 3 cases.
In line 342, compiler want to get something from
HWLoopInfo.CountType, which depends on if argument Bitwidth is given, if not,
will crash.
In Function isHardwareLoopCandidate, it dereference CountType too.
In Function InsertLoopDec, it dereference LoopDecrement.
They all could lead to crash. This patch add condition to this pass, when we meet unexpected inputs then skip
the pass.

Reviewed By: samparker, fhahn

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




More information about the All-commits mailing list