mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-18 11:24:01 +00:00
Disable transformation of select of two loads to a select of address and then a load if the
loads are not in the default address space because the transformation discards src value info. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93180 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -5792,8 +5792,20 @@ bool DAGCombiner::SimplifySelectOps(SDNode *TheSelect, SDValue LHS,
|
||||
if (LLD->getMemoryVT() == RLD->getMemoryVT()) {
|
||||
// FIXME: this discards src value information. This is
|
||||
// over-conservative. It would be beneficial to be able to remember
|
||||
// both potential memory locations.
|
||||
// both potential memory locations. Since we are discarding
|
||||
// src value info, don't do the transformation if the memory
|
||||
// locations are not in the default address space.
|
||||
unsigned LLDAddrSpace = 0, RLDAddrSpace = 0;
|
||||
if (const Value *LLDVal = LLD->getMemOperand()->getValue()) {
|
||||
if (const PointerType *PT = dyn_cast<PointerType>(LLDVal->getType()))
|
||||
LLDAddrSpace = PT->getAddressSpace();
|
||||
}
|
||||
if (const Value *RLDVal = RLD->getMemOperand()->getValue()) {
|
||||
if (const PointerType *PT = dyn_cast<PointerType>(RLDVal->getType()))
|
||||
RLDAddrSpace = PT->getAddressSpace();
|
||||
}
|
||||
SDValue Addr;
|
||||
if (LLDAddrSpace == 0 && RLDAddrSpace == 0) {
|
||||
if (TheSelect->getOpcode() == ISD::SELECT) {
|
||||
// Check that the condition doesn't reach either load. If so, folding
|
||||
// this will induce a cycle into the DAG.
|
||||
@ -5823,6 +5835,7 @@ bool DAGCombiner::SimplifySelectOps(SDNode *TheSelect, SDValue LHS,
|
||||
TheSelect->getOperand(4));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Addr.getNode()) {
|
||||
SDValue Load;
|
||||
|
Reference in New Issue
Block a user