[PATCH] D77076: [InstSimplify] Allow some arithmetic optimizations for add/sub/div/rem look through freeze
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 6 05:55:07 PDT 2020
lebedev.ri added inline comments.
================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:646
Value *Y = nullptr;
- if (match(Op1, m_Sub(m_Value(Y), m_Specific(Op0))) ||
- match(Op0, m_Sub(m_Value(Y), m_Specific(Op1))))
+ if (match(Op1, m_Sub(m_Value(Y), m_Specific(Op0, true))) ||
+ match(Op0, m_Sub(m_Value(Y), m_Specific(Op1, true))))
----------------
aqjune wrote:
> xbolva00 wrote:
> > Maybe m_SpecificAllowFreeze or so is more readable than passing true?
> Removed the true argument
Hmm yeah, i agree with @xbolva00 here, `m_Specific(StripFreeze())` seems not ideal,
i'd suggest two more matchers - `m_SpecificMaybeFrozen()` and `m_DeferredMaybeFrozen()`
that would do that.
================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:127
+/// If it is a freeze instruction, returns its operand
+static Value *StripFreeze(Value *V) {
+ if (auto *FI = dyn_cast<FreezeInst>(V))
----------------
Hm, do we have precedent naming scheme for things like this?
Alternative variants could include considered `IgnoreFreeze()` or `SkipFreeze()`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77076/new/
https://reviews.llvm.org/D77076
More information about the llvm-commits
mailing list