mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-19 04:29:21 +00:00
Enable a couple of xforms:
- (store (bitconvert v)) -> (store v) if resultant store does not require higher alignment - (bitconvert (load v)) -> (load (bitconvert*)v) if resultant load does not require higher alignment git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36908 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7d33b4c59b
commit
59d5b68dff
@ -34,7 +34,9 @@
|
||||
#include "llvm/CodeGen/SelectionDAG.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include "llvm/Target/TargetData.h"
|
||||
#include "llvm/Target/TargetLowering.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/Target/TargetOptions.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
@ -2569,10 +2571,14 @@ SDOperand DAGCombiner::visitBIT_CONVERT(SDNode *N) {
|
||||
return DAG.getNode(ISD::BIT_CONVERT, VT, N0.getOperand(0));
|
||||
|
||||
// fold (conv (load x)) -> (load (conv*)x)
|
||||
// FIXME: These xforms need to know that the resultant load doesn't need a
|
||||
// higher alignment than the original!
|
||||
if (0 && ISD::isNON_EXTLoad(N0.Val) && N0.hasOneUse()) {
|
||||
// If the resultant load doesn't need a higher alignment than the original!
|
||||
if (ISD::isNON_EXTLoad(N0.Val) && N0.hasOneUse() &&
|
||||
TLI.isOperationLegal(ISD::LOAD, VT)) {
|
||||
LoadSDNode *LN0 = cast<LoadSDNode>(N0);
|
||||
unsigned Align = TLI.getTargetMachine().getTargetData()->
|
||||
getPrefTypeAlignment(getTypeForValueType(VT));
|
||||
unsigned OrigAlign = LN0->getAlignment();
|
||||
if (Align <= OrigAlign) {
|
||||
SDOperand Load = DAG.getLoad(VT, LN0->getChain(), LN0->getBasePtr(),
|
||||
LN0->getSrcValue(), LN0->getSrcValueOffset(),
|
||||
LN0->isVolatile(), LN0->getAlignment());
|
||||
@ -2581,6 +2587,7 @@ SDOperand DAGCombiner::visitBIT_CONVERT(SDNode *N) {
|
||||
Load.getValue(1));
|
||||
return Load;
|
||||
}
|
||||
}
|
||||
|
||||
return SDOperand();
|
||||
}
|
||||
@ -3414,10 +3421,14 @@ SDOperand DAGCombiner::visitSTORE(SDNode *N) {
|
||||
SDOperand Value = ST->getValue();
|
||||
SDOperand Ptr = ST->getBasePtr();
|
||||
|
||||
// If this is a store of a bit convert, store the input value.
|
||||
// FIXME: This needs to know that the resultant store does not need a
|
||||
// higher alignment than the original.
|
||||
if (0 && Value.getOpcode() == ISD::BIT_CONVERT) {
|
||||
// If this is a store of a bit convert, store the input value if the
|
||||
// resultant store does not need a higher alignment than the original.
|
||||
if (Value.getOpcode() == ISD::BIT_CONVERT) {
|
||||
unsigned Align = ST->getAlignment();
|
||||
MVT::ValueType SVT = Value.getOperand(0).getValueType();
|
||||
unsigned OrigAlign = TLI.getTargetMachine().getTargetData()->
|
||||
getPrefTypeAlignment(getTypeForValueType(SVT));
|
||||
if (Align <= OrigAlign)
|
||||
return DAG.getStore(Chain, Value.getOperand(0), Ptr, ST->getSrcValue(),
|
||||
ST->getSrcValueOffset());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user