[all-commits] [llvm/llvm-project] 098ea2: [DAG] FoldConstantArithmetic - fold intop(bitcast(...

Simon Pilgrim via All-commits all-commits at lists.llvm.org
Thu Nov 11 03:36:55 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 098ea296418f16e7c17c11b953bde67a599779b7
      https://github.com/llvm/llvm-project/commit/098ea296418f16e7c17c11b953bde67a599779b7
  Author: Simon Pilgrim <llvm-dev at redking.me.uk>
  Date:   2021-11-11 (Thu, 11 Nov 2021)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
    M llvm/test/CodeGen/X86/packss.ll
    M llvm/test/CodeGen/X86/vector-fshl-rot-128.ll
    M llvm/test/CodeGen/X86/vector-fshr-rot-128.ll
    M llvm/test/CodeGen/X86/vector-shift-ashr-128.ll
    M llvm/test/CodeGen/X86/vector-shift-ashr-256.ll

  Log Message:
  -----------
  [DAG] FoldConstantArithmetic - fold intop(bitcast(buildvector(c1)),bitcast(buildvector(c1))) -> bitcast(intop(buildvector(c1'),buildvector(c2')))

Enable FoldConstantArithmetic to constant fold bitcasted constant build vectors. These have typically been bitcasted for type legalization purposes.

By extracting the raw constant bit data, performing the constant fold, and then casting the constant bit data back to the (legalized) type, we can perform constant folding on integer types after legalization.

This in particular helps 32-bit targets which need to handle vXi64 build vectors - during legalization the (unsupported) i64 elements are split to create a bitcasted v2Xi32 build vector.

Addresses some regressions in D113192.

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




More information about the All-commits mailing list