diff options
| author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-07-31 18:33:12 +0000 |
|---|---|---|
| committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-07-31 18:33:12 +0000 |
| commit | ab6adeb8a148ddd313e1220939bd2eb3bc63a328 (patch) | |
| tree | afab6cfe7d172364d5dee4924acc5c450003744c /llvm | |
| parent | 5a298679d5f6c38625244b1e86bd41c5b5c196dc (diff) | |
| download | bcm5719-llvm-ab6adeb8a148ddd313e1220939bd2eb3bc63a328.tar.gz bcm5719-llvm-ab6adeb8a148ddd313e1220939bd2eb3bc63a328.zip | |
UseListOrder: Handle self-users
Correctly sort self-users (such as PHI nodes). I added a targeted test
in `test/Bitcode/use-list-order.ll` and the final missing RUN line to
tests in `test/Assembly`.
This is part of PR5680.
llvm-svn: 214417
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/lib/Bitcode/Writer/ValueEnumerator.cpp | 6 | ||||
| -rw-r--r-- | llvm/test/Assembler/2002-08-22-DominanceProblem.ll | 1 | ||||
| -rw-r--r-- | llvm/test/Bitcode/use-list-order.ll | 13 |
3 files changed, 17 insertions, 3 deletions
diff --git a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp index 2ac53fea8a9..4ed739ebe4a 100644 --- a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp +++ b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp @@ -166,13 +166,13 @@ static void predictValueUseListOrderImpl(const Value *V, const Function *F, // If ID is 4, then expect: 7 6 5 1 2 3. if (LID < RID) { - if (RID < ID) + if (RID <= ID) if (!IsGlobalValue) // GlobalValue uses don't get reversed. return true; return false; } if (RID < LID) { - if (LID < ID) + if (LID <= ID) if (!IsGlobalValue) // GlobalValue uses don't get reversed. return false; return true; @@ -180,7 +180,7 @@ static void predictValueUseListOrderImpl(const Value *V, const Function *F, // LID and RID are equal, so we have different operands of the same user. // Assume operands are added in order for all instructions. - if (LID < ID) + if (LID <= ID) if (!IsGlobalValue) // GlobalValue uses don't get reversed. return LU->getOperandNo() < RU->getOperandNo(); return LU->getOperandNo() > RU->getOperandNo(); diff --git a/llvm/test/Assembler/2002-08-22-DominanceProblem.ll b/llvm/test/Assembler/2002-08-22-DominanceProblem.ll index 0dc192df235..4097f0ab629 100644 --- a/llvm/test/Assembler/2002-08-22-DominanceProblem.ll +++ b/llvm/test/Assembler/2002-08-22-DominanceProblem.ll @@ -1,4 +1,5 @@ ; RUN: llvm-as %s -o /dev/null +; RUN: verify-uselistorder %s -preserve-bc-use-list-order -num-shuffles=5 ; Dominance relationships is not calculated correctly for unreachable blocks, ; which causes the verifier to barf on this input. diff --git a/llvm/test/Bitcode/use-list-order.ll b/llvm/test/Bitcode/use-list-order.ll index 3d3a06ca9de..293650f4082 100644 --- a/llvm/test/Bitcode/use-list-order.ll +++ b/llvm/test/Bitcode/use-list-order.ll @@ -118,3 +118,16 @@ entry: %local = load i4* @globalAndFunction ret i4 %local } + +; Check for when an instruction is its own user. +define void @selfUser() { +entry: + ret void + +loop1: + br label %loop2 + +loop2: + %var = phi i32 [ %var, %loop1 ], [ %var, %loop2 ] + br label %loop1 +} |

