[PATCH] D57066: [TargetLowering] try harder to determine undef elements of vector binops

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 29 06:30:19 PST 2019


spatel marked an inline comment as done.
spatel added inline comments.


================
Comment at: lib/CodeGen/SelectionDAG/TargetLowering.cpp:1472
+    if (C0 && C1 && C0.getValueType() == EltVT && C1.getValueType() == EltVT)
+      if (DAG.getNode(BO.getOpcode(), SDLoc(BO), EltVT, C0, C1).isUndef())
+        KnownUndef.setBit(i);
----------------
RKSimon wrote:
> What's the policy on creating nodes on the fly like this?
I don't think it's stated anywhere, but we don't want to do it in general. 

I've seen cases in x86 lowering where a temp *variable* node is created speculatively and that inhibits other folds because it changes the number of uses of other values.

In this case, I've tried to ensure that we are only creating a constant or undef, so I could assert that to see if we escaped that assumption.

I may be missing some alternate means, but if we use FoldConstantArithmetic() directly, then we'll have to deal with FP separately because there's no equivalent/unified call for folding FP math. AFAIK, that's done directly within getNode().


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

https://reviews.llvm.org/D57066





More information about the llvm-commits mailing list