[PATCH] D51553: [DAGCombiner][x86] add transform/hook to load a scalar directly for use in a vector binop

Andrea Di Biagio via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 21 10:20:35 PDT 2018


andreadb added inline comments.


================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:15103-15105
+  const TargetLowering &TLI = DAG.getTargetLoweringInfo();
+  if (!TLI.shouldLoadScalarIntoVectorOp(SDValue(Ins, 0), BO))
+    return SDValue();
----------------
I wonder if this should be disabled for optsize/minsize.
On x86, this is going to increase .text, and it also potentially introduces a new constant in the pool.

```
mov (%rdi), %eax
add $0x2a, %eax
vmovd %eax, %xmm0
retq
```

is 10 bytes.

```
vmovd (%rdi), %xmm0
vpaddd 0x0(%rip), %xmm0, %xmm0  ## 4 bytes PC relative relocation
retq
```

is 13 bytes.

Plus, 16B in the constant pool (if we didn't see that constant before)...


https://reviews.llvm.org/D51553





More information about the llvm-commits mailing list