[PATCH] D42385: [InstSimplify] (X * Y) / Y --> X for relaxed floating-point ops
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 23 06:41:51 PST 2018
spatel added inline comments.
================
Comment at: lib/Analysis/InstructionSimplify.cpp:4300
+ if (FMF.allowReassoc() && match(Op0, m_c_FMul(m_Value(X), m_Specific(Op1))))
+ return X;
+
----------------
grandinj wrote:
> for these kinds of identities, should we not be matching
>
> (X * A * B * ....) / X
>
> ?
>
> i.e. whereever we are searching inside a group, we should scan until we hit a non-associative operator or an operator of different precedence ?
>
It's correct that this patch is too simple to handle that case, but I don't think we want to add more non-constant-time transforms to instsimplify. We should let the reassociation pass handle the bigger jobs...of course, reassociation could handle this case too, but solving the simple cases here means that other passes that use instsimplify as an analysis (GVN, etc) become stronger.
https://reviews.llvm.org/D42385
More information about the llvm-commits
mailing list