> Hello,
>
> I did a little experiment modifying LLVM to be able to use alias-
> analysis
> information in scheduling so that independent memory operations may be
> reordered.
I am not sure if it is a good idea to do this at scheduling time.
LLVM explicitly models control flows dependencies as chain operands.
This eliminated the need to do a separate edge drawing pass before
scheduling.
As you have seen there is transformations in dag combiner to
eliminate the unnecessary chain operands. It's not turned on by
default. Are you not getting satisfactory results by turning it on?
Oh, I see now that I misunderstood what the DAGCombiner was doing. The patch
I posted attempts to avoid unnecessary chain operands during the construction
of the DAG, while the DAGCombiner code works by cleaning up chain operands in
a separate pass. It looks like the end result is pretty similar.
> Attached is a patch which implements this. I copied some routines from
> DAGCombiner.cpp for using SDOperands with alias queries; it should
> probably be factored out somewhere so the code can be shared. I
> reorganized SelectionDAGLowering::getLoadFrom a little, to make it
> simpler to use in other contexts.
>
> Also, the patch fixes a bug where SelectionDAG::getLoad and
> SelectionDAG::getStore were being called with the wrong arguments,
> with
> a default argument helping to hide it.
Can you be more specific about what the bugs are?
Sure. SelectionDAG::getStore and getLoad are declared like this:
SDOperand getLoad(MVT::ValueType VT, SDOperand Chain, SDOperand Ptr,
const Value *SV, int SVOffset, bool isVolatile=false);
SDOperand getStore(SDOperand Chain, SDOperand Val, SDOperand Ptr,
const Value *SV, int SVOffset, bool isVolatile=false);
In SelectionDAGISel.cpp in SelectionDAGLowering::getLoadFrom and
SelectionDAGLowering::visitStore they are called like this:
L = DAG.getLoad(TLI.getValueType(Ty), Root, Ptr, SV, isVolatile);
DAG.setRoot(DAG.getStore(getRoot(), Src, Ptr, I.getOperand(1),
I.isVolatile()));
The isVolatile arguments are being passed to the SVOffset parameters.
Dan