[all-commits] [llvm/llvm-project] 82a1bf: [SelectionDAG] Do not crash on large integers in C...

Ulrich Weigand via All-commits all-commits at lists.llvm.org
Mon Dec 18 05:04:12 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 82a1bffd34dab41a379d5854ffa84332bd6456d2
      https://github.com/llvm/llvm-project/commit/82a1bffd34dab41a379d5854ffa84332bd6456d2
  Author: Ulrich Weigand <ulrich.weigand at de.ibm.com>
  Date:   2023-12-18 (Mon, 18 Dec 2023)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
    M llvm/test/CodeGen/SystemZ/xor-09.ll

  Log Message:
  -----------
  [SelectionDAG] Do not crash on large integers in CheckInteger (#75787)

The CheckInteger routine called from TableGen-generated selection logic
uses getSExtValue - which will abort if the underlying APInt does not
fit into an int64_t.

This case is now triggered by the SystemZ back-end since i128 is a legal
type on certain machines. While we do not have any regular instructions
that take 128-bit immediates (like most other platforms), there are
patterns in the .td files that recognize an i128 "xor ..., -1" as a
"not".

These patterns cause code to be generated that calls the CheckInteger
routine on some i128-valued integer, which may trigger the assert.

Fix by using trySExtValue instead.

Fixes https://github.com/llvm/llvm-project/issues/75710




More information about the All-commits mailing list