Capture this so that downstream zext/sext's are optimized out. This
compiles:
int test(short X) { return (int)X; }
to:
_test:
movl %edi, %eax
ret
instead of:
_test:
movswl %di, %eax
ret
GCC produces this bizarre code:
_test:
movw %di, -12(%rsp)
movswl -12(%rsp),%eax
ret
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34623 91177308-0d34-0410-b5e6-96231b3b80d8
sextinreg if not needed. This is useful in two cases: before legalize,
it avoids creating a sextinreg that will be trivially removed. After legalize
if the target doesn't support sextinreg, the trunc/sext would not have been
removed before.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34621 91177308-0d34-0410-b5e6-96231b3b80d8
2. Implement the trunc, sext, and zext operations.
3. Improve fromString to accept negative values as input.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34616 91177308-0d34-0410-b5e6-96231b3b80d8
exprs hanging off a global, even if the global is not otherwise dead. This
requires some tricky iterator gymnastics.
This implements Transforms/GlobalOpt/constantexpr-dangle.ll by deleting a
constantexpr that made it appear that the address of the function was taken.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34608 91177308-0d34-0410-b5e6-96231b3b80d8
2. Move comments for methods to .h file, delete them in .cpp file.
3. All places that were doing manual clear of high order bits now call the
clearUnusedBits() method in order to not depend on undefined behavior
of the >> operator when the number of bits shifted equals the word size.
4. Reduced # of loc by using the new result of clearUnusedBits() method.
5. Simplified logic (decreased indentation) in a few places.
6. Added code comments to larger functions that needed them.
7. Added FIXME notes about weak implementations of things (e.g. bit-by-bit
shift right is sub-optimal).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34603 91177308-0d34-0410-b5e6-96231b3b80d8
when the bit size is equal to the word size. This happens to work out okay
on x86, but might not on other platforms. The change just detects when
there are no bits to clear (because BitWidth is a multiple of the word size)
and returns early.
Also, move some comments from .cpp file into header.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34602 91177308-0d34-0410-b5e6-96231b3b80d8
external symbols and global addresses. Add the missing ones.
one important workaround: PPCISD::CALL is matched by both PPCcall_ELF
and PPCcall_Macho, disable the _ELF patterns for now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34601 91177308-0d34-0410-b5e6-96231b3b80d8
result value stuff. This eliminates a bunch of duplicated code and now
GetRetValueLocs is the sole place that decides where a value is returned.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34588 91177308-0d34-0410-b5e6-96231b3b80d8
function. This function now uses GetRetValueLocs to determine *where*
the result values are located and concerns itself with *how* to pull the
values out.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34586 91177308-0d34-0410-b5e6-96231b3b80d8
registers out from the logic of *how* to return them.
This changes X86-64 to mark EAX live out when returning a 32-bit value,
where before it marked RAX liveout.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34582 91177308-0d34-0410-b5e6-96231b3b80d8