diff options
author | Tom Stellard <thomas.stellard@amd.com> | 2013-11-18 19:43:38 +0000 |
---|---|---|
committer | Tom Stellard <thomas.stellard@amd.com> | 2013-11-18 19:43:38 +0000 |
commit | 827ec9b63004f1edef468edc66a43adb9797e75d (patch) | |
tree | 3fd9d2f4a0512ccd2f68f7617d371dfaaba04306 /llvm/lib | |
parent | 783893a893aab84ad6bc838be2dbb162093c9bcd (diff) | |
download | bcm5719-llvm-827ec9b63004f1edef468edc66a43adb9797e75d.tar.gz bcm5719-llvm-827ec9b63004f1edef468edc66a43adb9797e75d.zip |
R600: Fix a crash in the AMDILCFGStrucurizer
The ifPatternMatch() function was not correctly reporting the number
of matches in some cases.
llvm-svn: 195030
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/R600/AMDILCFGStructurizer.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/llvm/lib/Target/R600/AMDILCFGStructurizer.cpp b/llvm/lib/Target/R600/AMDILCFGStructurizer.cpp index beaaba86dae..507570fdcaa 100644 --- a/llvm/lib/Target/R600/AMDILCFGStructurizer.cpp +++ b/llvm/lib/Target/R600/AMDILCFGStructurizer.cpp @@ -1005,13 +1005,14 @@ int AMDGPUCFGStructurizer::ifPatternMatch(MachineBasicBlock *MBB) { return 0; assert(isCondBranch(BranchMI)); + int NumMatch = 0; MachineBasicBlock *TrueMBB = getTrueBranch(BranchMI); - serialPatternMatch(TrueMBB); - ifPatternMatch(TrueMBB); + NumMatch += serialPatternMatch(TrueMBB); + NumMatch += ifPatternMatch(TrueMBB); MachineBasicBlock *FalseMBB = getFalseBranch(MBB, BranchMI); - serialPatternMatch(FalseMBB); - ifPatternMatch(FalseMBB); + NumMatch += serialPatternMatch(FalseMBB); + NumMatch += ifPatternMatch(FalseMBB); MachineBasicBlock *LandBlk; int Cloned = 0; @@ -1040,7 +1041,7 @@ int AMDGPUCFGStructurizer::ifPatternMatch(MachineBasicBlock *MBB) { && isSameloopDetachedContbreak(FalseMBB, TrueMBB)) { LandBlk = *TrueMBB->succ_begin(); } else { - return handleJumpintoIf(MBB, TrueMBB, FalseMBB); + return NumMatch + handleJumpintoIf(MBB, TrueMBB, FalseMBB); } // improveSimpleJumpinfoIf can handle the case where landBlk == NULL but the @@ -1068,7 +1069,7 @@ int AMDGPUCFGStructurizer::ifPatternMatch(MachineBasicBlock *MBB) { numClonedBlock += Cloned; - return 1 + Cloned; + return 1 + Cloned + NumMatch; } int AMDGPUCFGStructurizer::loopendPatternMatch() { |