[PATCH] D118264: [DAG] SelectionDAG::getNode(N1,N2) - detect N2 constant vector splats as well as scalars
Vitaly Buka via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 10 19:08:47 PST 2022
vitalybuka added subscribers: eugenis, vitalybuka.
vitalybuka added inline comments.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:5649
+ isConstOrConstSplat(N2, /*AllowUndefs*/ false, /*AllowTruncation*/ true);
switch (Opcode) {
----------------
@RKSimon After this patch we see something that appears false msan report
cc @eugenis
We have a basic block
```
182: ; preds = %82
%183 = call <32 x i16> @llvm.x86.avx512.packusdw.512(<16 x i32> %176, <16 x i32> poison) #28, !dbg !276
%184 = and <32 x i16> %183, zeroinitializer, !dbg !277
%185 = or <32 x i16> zeroinitializer, %184, !dbg !277
%186 = or <32 x i16> %185, <i16 0, i16 0, i16 0, i16 0, i16 poison, i16 poison, i16 poison, i16 poison, i16 0, i16 0, i16 0, i16 0, i16 poison, i16 poison, i16 poison, i16 poison, i16 0, i16 0, i16 0, i16 0, i16 poison, i16 poison, i16 poison, i16 poison, i16 0, i16 0, i16 0, i16 0, i16 poison, i16 poison, i16 poison, i16 poison>, !dbg !277
%187 = and <32 x i16> %183, <i16 32767, i16 32767, i16 32767, i16 32767, i16 poison, i16 poison, i16 poison, i16 poison, i16 32767, i16 32767, i16 32767, i16 32767, i16 poison, i16 poison, i16 poison, i16 poison, i16 32767, i16 32767, i16 32767, i16 32767, i16 poison, i16 poison, i16 poison, i16 poison, i16 32767, i16 32767, i16 32767, i16 32767, i16 poison, i16 poison, i16 poison, i16 poison>, !dbg !277
%188 = bitcast <32 x i16> %186 to i512, !dbg !277
%_mscmp34 = icmp ne i512 %188, 0, !dbg !277
br i1 %_mscmp34, label %189, label %190, !dbg !277, !prof !27
```
before the patch
```
bb.4 (%ir-block.182):
; predecessors: %bb.2
successors: %bb.5, %bb.6
%291:vr512 = IMPLICIT_DEF
%290:vr512 = VPACKUSDWZrr %1:vr512, killed %291:vr512, debug-location !276; ./third_party/highway/hwy/ops/x86_512-inl.h:3056:30 @[ ./third_party/highway/hwy/examples/skeleton.cc:62:18 ]
%292:vr512 = VMOVDQA64Zrm $rip, 1, $noreg, %const.1, $noreg, debug-location !277 :: (load (s512) from constant-pool); ./third_party/highway/hwy/ops/x86_512-inl.h:3066:29 @[ ./third_party/highway/hwy/examples/skeleton.cc:62:18 ]
%2:vr512 = VPANDQZrr killed %290:vr512, killed %292:vr512, debug-location !277; ./third_party/highway/hwy/ops/x86_512-inl.h:3066:29 @[ ./third_party/highway/hwy/examples/skeleton.cc:62:18 ]
%293:gr8 = MOV8ri 1
TEST8rr %293:gr8, %293:gr8, implicit-def $eflags, debug-location !277; ./third_party/highway/hwy/ops/x86_512-inl.h:3066:29 @[ ./third_party/highway/hwy/examples/skeleton.cc:62:18 ]
JCC_1 %bb.6, 5, implicit $eflags, debug-location !277; ./third_party/highway/hwy/ops/x86_512-inl.h:3066:29 @[ ./third_party/highway/hwy/examples/skeleton.cc:62:18 ]
JMP_1 %bb.5, debug-location !277; ./third_party/highway/hwy/ops/x86_512-inl.h:3066:29 @[ ./third_party/highway/hwy/examples/skeleton.cc:62:18 ]
```
now it's
```
bb.4 (%ir-block.182):
; predecessors: %bb.2
successors: %bb.5, %bb.6
%291:vr512 = IMPLICIT_DEF
%290:vr512 = VPACKUSDWZrr %1:vr512, killed %291:vr512, debug-location !276; ./third_party/highway/hwy/ops/x86_512-inl.h:3056:30 @[ ./third_party/highway/hwy/examples/skeleton.cc:62:18 ]
%292:vr512 = VMOVDQA64Zrm $rip, 1, $noreg, %const.1, $noreg, debug-location !277 :: (load (s512) from constant-pool); ./third_party/highway/hwy/ops/x86_512-inl.h:3066:29 @[ ./third_party/highway/hwy/examples/skeleton.cc:62:18 ]
%2:vr512 = VPANDQZrr killed %290:vr512, killed %292:vr512, debug-location !277; ./third_party/highway/hwy/ops/x86_512-inl.h:3066:29 @[ ./third_party/highway/hwy/examples/skeleton.cc:62:18 ]
%293:gr32 = MOV32r0 implicit-def dead $eflags
%294:gr8 = COPY %293.sub_8bit:gr32
TEST8rr %294:gr8, %294:gr8, implicit-def $eflags, debug-location !277; ./third_party/highway/hwy/ops/x86_512-inl.h:3066:29 @[ ./third_party/highway/hwy/examples/skeleton.cc:62:18 ]
JCC_1 %bb.6, 5, implicit $eflags, debug-location !277; ./third_party/highway/hwy/ops/x86_512-inl.h:3066:29 @[ ./third_party/highway/hwy/examples/skeleton.cc:62:18 ]
JMP_1 %bb.5, debug-location !277; ./third_party/highway/hwy/ops/x86_512-inl.h:3066:29 @[ ./third_party/highway/hwy/examples/skeleton.cc:62:18 ]
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D118264/new/
https://reviews.llvm.org/D118264
More information about the llvm-commits
mailing list