1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
llvm-mirror/test
Fangrui Song f3bb2fa95f [X86] matchAdd: don't fold a large offset into a %rip relative address
For `ret i64 add (i64 ptrtoint (i32* @foo to i64), i64 1701208431)`,

```
X86DAGToDAGISel::matchAdd
  ...
// AM.setBaseReg(CurDAG->getRegister(X86::RIP, MVT::i64));
  if (!matchAddressRecursively(N.getOperand(0), AM, Depth+1) &&
// Try folding offset but fail; there is a symbolic displacement, so offset cannot be too large
      !matchAddressRecursively(Handle.getValue().getOperand(1), AM, Depth+1))
    return false;
  ...
  // Try again after commuting the operands.
// AM.Disp = Val; foldOffsetIntoAddress() does not know there will be a symbolic displacement
  if (!matchAddressRecursively(Handle.getValue().getOperand(1), AM, Depth+1) &&
// AM.setBaseReg(CurDAG->getRegister(X86::RIP, MVT::i64));
      !matchAddressRecursively(Handle.getValue().getOperand(0), AM, Depth+1))
// Succeeded! Produced leaq sym+disp(%rip),...
    return false;
```

`foldOffsetIntoAddress()` currently does not know there is a symbolic
displacement and can fold a large offset.

The produced `leaq sym+disp(%rip), %rax` instruction is relocated by
an R_X86_64_PC32. If disp is large and sym+disp-rip>=2**31, there
will be a relocation overflow.

This approach is still not elegant. Unfortunately the isRIPRelative
interface is a bit clumsy. I tried several solutions and eventually
picked this one.

Differential Revision: https://reviews.llvm.org/D73606
2020-01-28 22:30:52 -08:00
..
Analysis
Assembler
Bindings
Bitcode
BugPoint
CodeGen [X86] matchAdd: don't fold a large offset into a %rip relative address 2020-01-28 22:30:52 -08:00
DebugInfo [llvm] Fix broken cases of 'CHECK[^:]*$' in tests 2020-01-28 09:52:59 -07:00
Demangle
Examples
ExecutionEngine
Feature [IR] Keep a double break between functions when printing a module 2020-01-27 15:31:09 -08:00
FileCheck
Instrumentation [Instrumentation] Set hidden visibility for the bias variable 2020-01-28 12:07:03 -08:00
Integer
JitListener
Linker
LTO
MachineVerifier
MC [PowerPC][Future] Add pld and pstd to future CPU 2020-01-28 08:23:29 -06:00
Object [llvm-readobj][test] - Remove --symbols --dyn-syms part from Object/readobj-shared-object.test. 2020-01-28 12:36:29 +03:00
ObjectYAML
Other [instrinsics] Add @llvm.memcpy.inline instrinsics 2020-01-28 09:42:01 +01:00
Reduce
SafepointIRVerifier
Support
SymbolRewriter
TableGen
ThinLTO/X86
tools llvm-symbolizer test: Add a bit of extra detail on how to compile/reproduce this 2020-01-28 11:07:47 -08:00
Transforms [Attributor][FIX] Treat invalidated attributes as changed 2020-01-28 23:40:41 -06:00
Unit
Verifier [instrinsics] Add @llvm.memcpy.inline instrinsics 2020-01-28 09:42:01 +01:00
YAMLParser
.clang-format
CMakeLists.txt
lit.cfg.py
lit.site.cfg.py.in
TestRunner.sh