[PATCH] D113202: [DAG] FoldConstantArithmetic - fold bitlogic(bitcast(x),bitcast(y)) -> bitcast(bitlogic(x,y))

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 4 09:58:08 PDT 2021


RKSimon created this revision.
RKSimon added reviewers: spatel, dmgreen, efriedma, craig.topper, lebedev.ri.
Herald added subscribers: pengfei, hiraditya.
RKSimon requested review of this revision.
Herald added a project: LLVM.

To constant fold bitwise logic ops where we've legalized constant build vectors to a different type (e.g. v2i64 -> v4i32), this patch adds a basic ability to peek through the bitcasts and perform the constant fold on the inner operands.

@dmgreen I'm not sure what is the best fix for the MVE predicate v2i64 regressions - its expanded the bitselect patten and constant folded the 'andnot(x,c)' to 'and(x,~c)' - this was already bad codegen, I think ideally this should be narrowed to a v4i32 equivalent, but I'm not sure how best to address this - hints welcome :)

One of the yak shaving fixes for D113192 <https://reviews.llvm.org/D113192>....


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D113202

Files:
  llvm/include/llvm/CodeGen/ISDOpcodes.h
  llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
  llvm/test/CodeGen/Thumb2/mve-pred-build-const.ll
  llvm/test/CodeGen/X86/vector-fshl-128.ll
  llvm/test/CodeGen/X86/vector-fshl-rot-128.ll
  llvm/test/CodeGen/X86/vector-fshr-128.ll
  llvm/test/CodeGen/X86/vector-fshr-rot-128.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113202.384788.patch
Type: text/x-patch
Size: 11750 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211104/3ac18673/attachment.bin>


More information about the llvm-commits mailing list