[all-commits] [llvm/llvm-project] d897a1: [SystemZ] Fix check for zero size when lowering me...

Kai Nacke via All-commits all-commits at lists.llvm.org
Wed Jun 8 11:52:55 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d897a14c2ef756d99344f4fae8864108e0131007
      https://github.com/llvm/llvm-project/commit/d897a14c2ef756d99344f4fae8864108e0131007
  Author: Kai Nacke <kai.nacke at de.ibm.com>
  Date:   2022-06-08 (Wed, 08 Jun 2022)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
    A llvm/test/CodeGen/SystemZ/memcmp-03.ll

  Log Message:
  -----------
  [SystemZ] Fix check for zero size when lowering memcmp.

During lowering of memcmp/bcmp, the check for a size of 0 is done
in 2 different ways. In rare cases this can lead to a crash in
SystemZSelectionDAGInfo::EmitTargetCodeForMemcmp(). The root cause
is that SelectionDAGBuilder::visitMemCmpBCmpCall() checks for a
constant int value which is not yet evaluated. When the value is
turned into a SDValue, then the evaluation is done and results in
a ConstantSDNode. But EmitTargetCodeForMemcmp() expects the special
case of 0 length to be handled, which results in an assertion.

The fix is to turn the value into a SDValue, so that both functions
use the same check.

Reviewed By: uweigand

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




More information about the All-commits mailing list