[PATCH] D132333: [DAG] Strip poison generating flags in freeze(op()) -> op(freeze()) fold
Simon Pilgrim via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 21 11:28:24 PDT 2022
RKSimon created this revision.
RKSimon added reviewers: spatel, nlopes, efriedma.
Herald added subscribers: ecnelises, pengfei, hiraditya.
Herald added a project: All.
RKSimon requested review of this revision.
Herald added a project: LLVM.
This patch follows the InstCombine approach of stripping poison generating flags (nsw/nuw from add/sub etc.) to allow us to push a freeze() through the op. It's coaser than InstCombine as it doesn't retain any flags, but we have plenty of DAG folds that do the same thing already. We assert that the newly generated op isGuaranteedNotToBeUndefOrPoison.
Similar to the ValueTracking approach, isGuaranteedNotToBeUndefOrPoison has been updated to confirm that if an op can't create undef/poison and its operands are guaranteed to be undef/poison - then its not undef/poison. This is just for the generic opcodes . - target specific opcodes will need to do this manually just in case they have some special cases.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D132333
Files:
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/test/CodeGen/X86/freeze-binary.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132333.454332.patch
Type: text/x-patch
Size: 4908 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220821/2c1604ba/attachment.bin>
More information about the llvm-commits
mailing list