[PATCH] D28813: [CodeGenPrepare] Sink and duplicate more 'and' instructions.

Chad Rosier via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 17 14:34:11 PST 2017


mcrosier added inline comments.


================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:1105
+
+  if (!TLI.isMaskAndCmp0FoldingBeneficial(*AndI))
+    return false;
----------------
minor nit: Would it make sense for this check to be first?  That would avoid unnecessary work for those targets that don't enable this optimization.


================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:1112
+    // Only sink for and mask feeding icmp with 0.
+    if (!dyn_cast<ICmpInst>(User))
+      return false;
----------------
dyn_cast -> isa


================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:4699
       Builder.CreateAnd(Load, ConstantInt::get(Ctx, DemandBits)));
+  // Mark this instruction as "inserted by CGP", so that other
+  // optimizations don't touch it.
----------------
I'm curious if this change in isolation prevented some other optimizations from happening?


https://reviews.llvm.org/D28813





More information about the llvm-commits mailing list