diff options
author | Michael Kuperstein <mkuper@google.com> | 2016-07-13 23:23:40 +0000 |
---|---|---|
committer | Michael Kuperstein <mkuper@google.com> | 2016-07-13 23:23:40 +0000 |
commit | be837fa40f12543ea4120cdd09ffcfc2535b13c5 (patch) | |
tree | 956e4206a3340a645922bc0801aa3ef88e78a2d5 /llvm/lib | |
parent | 296e9785ba820372831ef7a74f93a4399507d3eb (diff) | |
download | bcm5719-llvm-be837fa40f12543ea4120cdd09ffcfc2535b13c5.tar.gz bcm5719-llvm-be837fa40f12543ea4120cdd09ffcfc2535b13c5.zip |
[DAG] Correctly chain masked loads
If a masked loads is not added to the chain, it should not reset the chain's
root.
This fixes the remaining part of PR28515.
llvm-svn: 275340
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 27ee96dfedf..7bf58514bdb 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -3831,13 +3831,10 @@ void SelectionDAGBuilder::visitMaskedLoad(const CallInst &I) { I.getAAMetadata(AAInfo); const MDNode *Ranges = I.getMetadata(LLVMContext::MD_range); - SDValue InChain = DAG.getRoot(); - if (AA->pointsToConstantMemory(MemoryLocation( - PtrOperand, DAG.getDataLayout().getTypeStoreSize(I.getType()), - AAInfo))) { - // Do not serialize (non-volatile) loads of constant memory with anything. - InChain = DAG.getEntryNode(); - } + // Do not serialize masked loads of constant memory with anything. + bool AddToChain = !AA->pointsToConstantMemory(MemoryLocation( + PtrOperand, DAG.getDataLayout().getTypeStoreSize(I.getType()), AAInfo)); + SDValue InChain = AddToChain ? DAG.getRoot() : InChain = DAG.getEntryNode(); MachineMemOperand *MMO = DAG.getMachineFunction(). @@ -3847,8 +3844,10 @@ void SelectionDAGBuilder::visitMaskedLoad(const CallInst &I) { SDValue Load = DAG.getMaskedLoad(VT, sdl, InChain, Ptr, Mask, Src0, VT, MMO, ISD::NON_EXTLOAD); - SDValue OutChain = Load.getValue(1); - DAG.setRoot(OutChain); + if (AddToChain) { + SDValue OutChain = Load.getValue(1); + DAG.setRoot(OutChain); + } setValue(&I, Load); } |