[all-commits] [llvm/llvm-project] 88c7b1: [DAG] Strip poison generating flags in freeze(op()...

Simon Pilgrim via All-commits all-commits at lists.llvm.org
Fri Aug 26 03:48:17 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 88c7b16bede8a0b070fd74f05e0ae88833629e5b
      https://github.com/llvm/llvm-project/commit/88c7b16bede8a0b070fd74f05e0ae88833629e5b
  Author: Simon Pilgrim <llvm-dev at redking.me.uk>
  Date:   2022-08-26 (Fri, 26 Aug 2022)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
    M llvm/test/CodeGen/X86/freeze-binary.ll

  Log Message:
  -----------
  [DAG] Strip poison generating flags in freeze(op()) -> op(freeze()) fold

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. Unlike InstCombine 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 not 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.

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




More information about the All-commits mailing list