[PATCH] D112734: [SCEVExpander] Drop poison generating flags when reusing instructions

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 16 08:41:27 PST 2021


reames added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp:1947
+          !programUndefinedIfPoison(I))
+        I->dropPoisonGeneratingFlags();
+
----------------
mkazantsev wrote:
> reames wrote:
> > mkazantsev wrote:
> > > Will we drop flags if both copies had them?
> > What do you mean by "both copies"?
> The comment before this code mentions that we are CSEing two copies of same instruction with potentially different flags, and drop them if we failed to prove legality. But what if both of these copies had the same flags, do we still need to try to prove something and drop the flags? Why?
Ah.  The problem is that one of the two instructions is unknown.  It corresponds to the SCEV we're generating, and translating SCEV flags directly to instruction flags is non-trivial.  As such, we must use the worst interpretation for the unknown instruction.  As such, we're effectively CSEing an instruction with no-flags with whatever instruction we decided to reuse, and thus have to drop flags.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112734/new/

https://reviews.llvm.org/D112734



More information about the llvm-commits mailing list