nir/large_constants: more careful data copying

A filed of nir_variable.location may be equel to -1.
That may cause copying to invalid address of list-node,
making some internal fields corrupted.

Patch fixes segfault during freeing context due to
corrupted address of ralloc_header.destructor.

v2: copy data if var is constant (Connor Abbott)

CC: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Fixes: b6d47535 (nir/large_constants: De-duplicate constants)
Signed-off-by: Sergii Romantsov <sergii.romantsov@globallogic.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111676
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
38 jobs for !1948 with fix/tropico6_iris_crash in 42 minutes and 1 second (queued for 6 seconds)
latest detached
Status Job ID Name Coverage
  Containers
passed #610483
debian

00:00:38

passed #610484
aarch64
test-container:arm64

00:00:19

 
  Build
passed #610493
meson-arm64

00:05:13

passed #610492
meson-armhf

00:03:59

passed #610487
meson-clang

00:12:03

passed #610490
meson-clover

00:10:10

passed #610494
meson-i386

00:03:53

passed #610485
meson-main

00:10:42

passed #610486
meson-swr-glvnd

00:07:48

passed #610491
meson-vulkan

00:02:26

passed #610496
scons-llvm

00:06:22

passed #610495
scons-nollvm

00:03:02

passed #610488
scons-swr

00:05:00

passed #610489
scons-win64

00:06:35

 
  Test
passed #610506
db410c
arm64_a306_gles2 1/4

00:12:22

passed #610507
db410c
arm64_a306_gles2 2/4

00:14:07

passed #610508
db410c
arm64_a306_gles2 3/4

00:12:10

passed #610509
db410c
arm64_a306_gles2 4/4

00:12:08

passed #610510
mesa-cheza
arm64_a630_gles2

00:04:40

passed #610517
mesa-cheza
arm64_a630_gles31 1/4

00:06:31

passed #610518
mesa-cheza
arm64_a630_gles31 2/4

00:07:40

passed #610519
mesa-cheza
arm64_a630_gles31 3/4

00:07:31

passed #610520
mesa-cheza
arm64_a630_gles31 4/4

00:07:29

passed #610511
mesa-cheza
arm64_a630_gles3 1/6

00:04:25

passed #610512
mesa-cheza
arm64_a630_gles3 2/6

00:04:10

passed #610513
mesa-cheza
arm64_a630_gles3 3/6

00:04:01

passed #610514
mesa-cheza
arm64_a630_gles3 4/6

00:04:40

passed #610515
mesa-cheza
arm64_a630_gles3 5/6

00:04:17

passed #610516
mesa-cheza
arm64_a630_gles3 6/6

00:04:31

passed #610497
test-llvmpipe-gles2 1/4

00:04:32

passed #610498
test-llvmpipe-gles2 2/4

00:04:38

passed #610499
test-llvmpipe-gles2 3/4

00:04:20

passed #610500
test-llvmpipe-gles2 4/4

00:04:17

passed #610501
test-softpipe-gles2 1/4

00:01:32

passed #610502
test-softpipe-gles2 2/4

00:01:49

passed #610503
test-softpipe-gles2 3/4

00:01:39

passed #610504
test-softpipe-gles2 4/4

00:01:32

passed #610505
test-softpipe-gles3-limited

00:05:15