summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2017-06-20 18:56:32 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2017-06-20 18:56:32 +0000
commitff3f912e74473ddae39fa261eeeae2ac6777c392 (patch)
tree196d1db3be825d3a55b0e26c8c6a1011d64dcf7e /llvm/lib
parentf10ca93f34d3c88dfed98bfef28f45c8088d4ace (diff)
downloadbcm5719-llvm-ff3f912e74473ddae39fa261eeeae2ac6777c392.tar.gz
bcm5719-llvm-ff3f912e74473ddae39fa261eeeae2ac6777c392.zip
AMDGPU: Do operand folding in program order
Before it was possible to partially fold use instructions before the defs. After the xor is folded into a copy, the same mov can end up in the fold list twice, so on the second attempt it will fail expecting to see a register to fold. llvm-svn: 305821
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/AMDGPU/SIFoldOperands.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp b/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp
index 92d59569226..f391f67a241 100644
--- a/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp
+++ b/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp
@@ -13,6 +13,7 @@
#include "AMDGPUSubtarget.h"
#include "SIInstrInfo.h"
#include "SIMachineFunctionInfo.h"
+#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/CodeGen/LiveIntervalAnalysis.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
@@ -923,12 +924,9 @@ bool SIFoldOperands::runOnMachineFunction(MachineFunction &MF) {
// level.
bool IsIEEEMode = ST->enableIEEEBit(MF) || !MFI->hasNoSignedZerosFPMath();
- for (MachineFunction::iterator BI = MF.begin(), BE = MF.end();
- BI != BE; ++BI) {
-
- MachineBasicBlock &MBB = *BI;
+ for (MachineBasicBlock *MBB : depth_first(&MF)) {
MachineBasicBlock::iterator I, Next;
- for (I = MBB.begin(); I != MBB.end(); I = Next) {
+ for (I = MBB->begin(); I != MBB->end(); I = Next) {
Next = std::next(I);
MachineInstr &MI = *I;
OpenPOWER on IntegriCloud