Avoid losing Hi part when expanding VAARG nodes on big endian machines
authorDaniel Cederman <cederman@gaisler.com>
Mon, 16 Jul 2018 12:14:17 +0000 (12:14 +0000)
committerDaniel Cederman <cederman@gaisler.com>
Mon, 16 Jul 2018 12:14:17 +0000 (12:14 +0000)
commitc3d8002c2e1b41a05095f6a0f2e720fa9bb63c00
treeab6579930e17321a84e81abd777d57218f7ba968
parente66a6f48e314c84d00e9580fa3d30fadb683dd11
Avoid losing Hi part when expanding VAARG nodes on big endian machines

Summary:
If the high part of the load is not used the offset to the next element
will not be set correctly.

For example, on Sparc V8, the following code will read val2 from offset 4
instead of 8.

```
int val = __builtin_va_arg(va, long long);
int val2 = __builtin_va_arg(va, int);
```

Reviewers: jyknight

Reviewed By: jyknight

Subscribers: fedor.sergeev, jrtc27, llvm-commits

Differential Revision: https://reviews.llvm.org/D48595

llvm-svn: 337161
llvm/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp
llvm/test/CodeGen/SPARC/varargs-v8.ll [new file with mode: 0644]