[PATCH] D18942: [X86] remove unneeded variables
Asaf Badouh via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 10 06:22:31 PDT 2016
AsafBadouh created this revision.
AsafBadouh added reviewers: aaboud, DavidKreitzer.
AsafBadouh added a subscriber: llvm-commits.
AsafBadouh set the repository for this revision to rL LLVM.
no functional change.
ExtraLoad and WrapperKind are been used only if (OpFlags == X86II::MO_GOTPCREL).
The original code had a bug:
```
Callee = DAG.getNode(X86ISD::WrapperRIP, dl,
getPointerTy(DAG.getDataLayout()), Callee);
```
where it should be:
```
Callee = DAG.getNode( WrapperKind, dl,
getPointerTy(DAG.getDataLayout()), Callee);
```
anyway, WrapperKind removed.
Repository:
rL LLVM
http://reviews.llvm.org/D18942
Files:
../llvmOrg/lib/Target/X86/X86ISelLowering.cpp
Index: ../llvmOrg/lib/Target/X86/X86ISelLowering.cpp
===================================================================
--- ../llvmOrg/lib/Target/X86/X86ISelLowering.cpp
+++ ../llvmOrg/lib/Target/X86/X86ISelLowering.cpp
@@ -3357,8 +3357,6 @@
const GlobalValue *GV = G->getGlobal();
if (!GV->hasDLLImportStorageClass()) {
unsigned char OpFlags = 0;
- bool ExtraLoad = false;
- unsigned WrapperKind = ISD::DELETED_NODE;
// On ELF targets, in both X86-64 and X86-32 mode, direct calls to
// external symbols most go through the PLT in PIC mode. If the symbol
@@ -3382,23 +3380,21 @@
// which loads from the GOT directly. This avoids runtime overhead
// at the cost of eager binding (and one extra byte of encoding).
OpFlags = X86II::MO_GOTPCREL;
- WrapperKind = X86ISD::WrapperRIP;
- ExtraLoad = true;
}
Callee = DAG.getTargetGlobalAddress(
GV, dl, getPointerTy(DAG.getDataLayout()), G->getOffset(), OpFlags);
- // Add a wrapper if needed.
- if (WrapperKind != ISD::DELETED_NODE)
+ if (OpFlags == X86II::MO_GOTPCREL) {
+ // Add a wrapper.
Callee = DAG.getNode(X86ISD::WrapperRIP, dl,
- getPointerTy(DAG.getDataLayout()), Callee);
- // Add extra indirection if needed.
- if (ExtraLoad)
+ getPointerTy(DAG.getDataLayout()), Callee);
+ // Add extra indirection
Callee = DAG.getLoad(
- getPointerTy(DAG.getDataLayout()), dl, DAG.getEntryNode(), Callee,
- MachinePointerInfo::getGOT(DAG.getMachineFunction()), false, false,
- false, 0);
+ getPointerTy(DAG.getDataLayout()), dl, DAG.getEntryNode(), Callee,
+ MachinePointerInfo::getGOT(DAG.getMachineFunction()), false, false,
+ false, 0);
+ }
}
} else if (ExternalSymbolSDNode *S = dyn_cast<ExternalSymbolSDNode>(Callee)) {
unsigned char OpFlags = 0;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18942.53175.patch
Type: text/x-patch
Size: 2019 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160410/2212e9a8/attachment.bin>
More information about the llvm-commits
mailing list