[PATCH] D76664: [ConstantFold][NFC] Compile time optimization for large vectors

David Majnemer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 24 15:06:45 PDT 2020


majnemer added inline comments.


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:179
+  if (isa<ConstantAggregateZero>(Shuf->getMask())) {
+    DemandedLHS.setBit(0);
+    return true;
----------------
ThomasRaoux wrote:
> majnemer wrote:
> > Is it OK to set DemandedLHS bit 0 when DemandedElts[0] is false?
> It is okay as long as DemandedElts has at least one bit set. With current code this function would never be called with an empty DemandedElts but I added an early check for this case to handle this case.
Is it OK that the loop bellow only sets DemandedLHS[0] if DemandedElts[i] is true for some multiple of NumElts while this logic will set it unconditionally?


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:177-178
   DemandedLHS = DemandedRHS = APInt::getNullValue(NumElts);
-
+  if (DemandedElts.isNullValue())
+    return true;
+  // Simple case of a shuffle with zeroinitializer.
----------------
I'd float this to the top before we create more APInts.


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

https://reviews.llvm.org/D76664





More information about the llvm-commits mailing list