Bitcode: Correctly compare a Use against itself

Fix the sort of expected order in the reader to correctly return `false`
when comparing a `Use` against itself.

This was caught by test/Bitcode/binaryIntInstructions.3.2.ll, so I'm
adding a `RUN` line using `llvm-uselistorder` for every test in
`test/Bitcode` that passes.

A few tests still fail, so I'll investigate those next.

This is part of PR5680.

llvm-svn: 214157
This commit is contained in:
Duncan P. N. Exon Smith 2014-07-29 01:13:56 +00:00
parent fee1f5013c
commit 3f0fc7bca9
36 changed files with 38 additions and 0 deletions

View File

@ -106,6 +106,9 @@ static void predictValueUseListOrderImpl(const Value *V, const Function *F,
[&OM, ID](const Entry &L, const Entry &R) {
const Use *LU = L.first;
const Use *RU = R.first;
if (LU == RU)
return false;
auto LID = OM.lookup(LU->getUser()).first;
auto RID = OM.lookup(RU->getUser()).first;
// If ID is 4, then expect: 7 6 5 1 2 3.

View File

@ -1,6 +1,7 @@
; This test ensures that we get a bitcast constant expression in and out,
; not a sitofp constant expression.
; RUN: llvm-as < %s | llvm-dis | FileCheck %s
; RUN: llvm-uselistorder < %s -preserve-bc-use-list-order -num-shuffles=5
; CHECK: bitcast (
@G = external global i32

View File

@ -1,4 +1,5 @@
; RUN: llvm-as < %s | llvm-dis -disable-output
; RUN: llvm-uselistorder < %s -preserve-bc-use-list-order -num-shuffles=5
; PR4373
@foo = weak global { i32 } zeroinitializer

View File

@ -1,4 +1,5 @@
; RUN: llvm-dis < %s.bc| FileCheck %s
; RUN: llvm-uselistorder < %s.bc -preserve-bc-use-list-order -num-shuffles=5
; aggregateOperations.3.2.ll.bc was generated by passing this file to llvm-as-3.2.
; The test checks that LLVM does not misread instructions with aggregate operands

View File

@ -1,4 +1,5 @@
; RUN: llvm-as < %s | llvm-dis | FileCheck %s
; RUN: llvm-uselistorder < %s -preserve-bc-use-list-order -num-shuffles=5
; Tests vclz and vcnt
define <4 x i16> @vclz16(<4 x i16>* %A) nounwind {

View File

@ -1,4 +1,5 @@
; RUN: llvm-as %s -o - | llvm-dis | FileCheck %s
; RUN: llvm-uselistorder < %s -preserve-bc-use-list-order -num-shuffles=5
define void @test_cmpxchg(i32* %addr, i32 %desired, i32 %new) {
cmpxchg i32* %addr, i32 %desired, i32 %new seq_cst seq_cst

View File

@ -1,4 +1,5 @@
; RUN: llvm-dis < %s.bc| FileCheck %s
; RUN: llvm-uselistorder < %s.bc -preserve-bc-use-list-order -num-shuffles=5
; attributes-3.3.ll.bc was generated by passing this file to llvm-as-3.3.
; The test checks that LLVM does not silently misread attributes of

View File

@ -1,4 +1,5 @@
; RUN: llvm-as < %s | llvm-dis | FileCheck %s
; RUN: llvm-uselistorder < %s -preserve-bc-use-list-order -num-shuffles=5
; PR12696
define void @f1(i8 zeroext)

View File

@ -1,4 +1,5 @@
; RUN: llvm-dis < %s.bc| FileCheck %s
; RUN: llvm-uselistorder < %s.bc -preserve-bc-use-list-order -num-shuffles=5
; BinaryFloatOperation.3.2.ll.bc was generated by passing this file to llvm-as-3.2.
; The test checks that LLVM does not misread binary float instructions from

View File

@ -1,4 +1,5 @@
; RUN: llvm-dis < %s.bc| FileCheck %s
; RUN: llvm-uselistorder < %s.bc -preserve-bc-use-list-order -num-shuffles=5
; BinaryIntOperation.3.2.ll.bc was generated by passing this file to llvm-as-3.2.
; The test checks that LLVM does not misread binary integer instructions from

View File

@ -1,4 +1,5 @@
; RUN: llvm-dis < %s.bc| FileCheck %s
; RUN: llvm-uselistorder < %s.bc -preserve-bc-use-list-order -num-shuffles=5
; bitwiseOperations.3.2.ll.bc was generated by passing this file to llvm-as-3.2.
; The test checks that LLVM does not misread bitwise instructions from

View File

@ -1,4 +1,5 @@
; RUN: llvm-dis < %s.bc| FileCheck %s
; RUN: llvm-uselistorder < %s.bc -preserve-bc-use-list-order -num-shuffles=5
; calling-conventions.3.2.ll.bc was generated by passing this file to llvm-as-3.2.
; The test checks that LLVM does not silently misread calling conventions of

View File

@ -1,4 +1,5 @@
; RUN: llvm-dis < %s.bc| FileCheck %s
; RUN: llvm-uselistorder < %s.bc -preserve-bc-use-list-order -num-shuffles=5
; case-ranges.ll.bc was generated by passing this file to llvm-as from the 3.3
; release of LLVM. This tests that the bitcode for switches from that release

View File

@ -1,4 +1,5 @@
; RUN: llvm-dis < %s.bc | FileCheck %s
; RUN: llvm-uselistorder < %s.bc -preserve-bc-use-list-order -num-shuffles=5
; cmpxchg-upgrade.ll.bc was produced by running a version of llvm-as from just
; before the IR change on this file.

View File

@ -1,4 +1,5 @@
; RUN: llvm-dis < %s.bc| FileCheck %s
; RUN: llvm-uselistorder < %s.bc -preserve-bc-use-list-order -num-shuffles=5
; conversionOperations.3.2.ll.bc was generated by passing this file to llvm-as-3.2.
; The test checks that LLVM does not misread conversion instructions from

View File

@ -1,5 +1,6 @@
; RUN: llvm-as < %s -o %t.bc 2>&1 >/dev/null | FileCheck -check-prefix=WARN %s
; RUN: llvm-dis < %t.bc | FileCheck %s
; RUN: llvm-uselistorder < %t.bc -preserve-bc-use-list-order -num-shuffles=5
define i32 @main() {
entry:

View File

@ -1,4 +1,5 @@
; RUN: opt < %s -constprop | llvm-dis -disable-output
; RUN: llvm-uselistorder < %s -preserve-bc-use-list-order -num-shuffles=5
; PR3465
define double @test() {

View File

@ -1,6 +1,7 @@
; RUN: llvm-as < %s | llvm-dis > %t0
; RUN: opt -S < %s > %t1
; RUN: diff %t0 %t1
; RUN: llvm-uselistorder < %s -preserve-bc-use-list-order -num-shuffles=5
; PR6140
; Make sure the flags are serialized/deserialized properly for both

View File

@ -1,6 +1,7 @@
; Basic sanity test to check that instruction operands are encoded with
; relative IDs.
; RUN: llvm-as < %s | llvm-bcanalyzer -dump | FileCheck %s
; RUN: llvm-uselistorder < %s -preserve-bc-use-list-order -num-shuffles=5
; CHECK: FUNCTION_BLOCK
; CHECK: INST_BINOP {{.*}}op0=1 op1=1

View File

@ -1,4 +1,5 @@
; RUN: llvm-dis < %s.bc| FileCheck %s
; RUN: llvm-uselistorder < %s.bc -preserve-bc-use-list-order -num-shuffles=5
; global-variables.3.2.ll.bc was generated by passing this file to llvm-as-3.2.
; The test checks that LLVM does not silently misread global variables attributes of

View File

@ -1,4 +1,5 @@
; RUN: llvm-as < %s | llvm-dis | FileCheck %s
; RUN: llvm-uselistorder < %s -preserve-bc-use-list-order -num-shuffles=5
; inalloca should roundtrip.

View File

@ -1,4 +1,5 @@
; RUN: llvm-dis < %s.bc| FileCheck %s
; RUN: llvm-uselistorder < %s.bc -preserve-bc-use-list-order -num-shuffles=5
; linkage-types-3.2.ll.bc was generated by passing this file to llvm-as-3.2
; The test checks that LLVM does not silently misread linkage types of

View File

@ -1,4 +1,5 @@
; RUN: llvm-dis < %s.bc| FileCheck %s
; RUN: llvm-uselistorder < %s.bc -preserve-bc-use-list-order -num-shuffles=5
; memOperations.3.2.ll.bc was generated by passing this file to llvm-as-3.2.
; The test checks that LLVM does not misread memory related instructions of

View File

@ -1,4 +1,5 @@
; RUN: llvm-as < %s | llvm-dis -disable-output
; RUN: llvm-uselistorder < %s -preserve-bc-use-list-order -num-shuffles=5
!llvm.foo = !{!0}
!0 = metadata !{i32 42}

View File

@ -1,4 +1,5 @@
; RUN: llvm-as < %s | llvm-dis | FileCheck %s
; RUN: llvm-uselistorder < %s -preserve-bc-use-list-order -num-shuffles=5
define i32 @foo(<2 x i64> %bar) nounwind {
entry:

View File

@ -1,4 +1,5 @@
; RUN: llvm-as < %s | llvm-dis | FileCheck %s
; RUN: llvm-uselistorder < %s -preserve-bc-use-list-order -num-shuffles=5
define i32 @foo(<4 x float> %bar) nounwind {
entry:

View File

@ -1,4 +1,5 @@
; RUN: llvm-as < %s | llvm-dis | FileCheck %s
; RUN: llvm-uselistorder < %s -preserve-bc-use-list-order -num-shuffles=5
define <2 x i32> @main() {
ret <2 x i32> select (<2 x i1> <i1 false, i1 undef>, <2 x i32> zeroinitializer, <2 x i32> <i32 0, i32 undef>)

View File

@ -1,4 +1,5 @@
; RUN: llvm-as < %s | llvm-dis -disable-output
; RUN: llvm-uselistorder < %s -preserve-bc-use-list-order -num-shuffles=5
; <rdar://problem/8622574>
; tests the bitcodereader can handle the case where the reader will initially

View File

@ -1,4 +1,5 @@
; RUN: llvm-as < %s | llvm-dis | FileCheck %s
; RUN: llvm-uselistorder < %s -preserve-bc-use-list-order -num-shuffles=5
; Check that musttail and tail roundtrip.

View File

@ -1,4 +1,5 @@
; RUN: llvm-dis < %s.bc| FileCheck %s
; RUN: llvm-uselistorder < %s.bc -preserve-bc-use-list-order -num-shuffles=5
; TerminatorOperations.3.2.ll.bc was generated by passing this file to llvm-as-3.2.
; The test checks that LLVM does not misread terminator instructions from

View File

@ -1,3 +1,4 @@
; RUN: llvm-dis < %s.bc| FileCheck %s
; RUN: llvm-uselistorder < %s.bc -preserve-bc-use-list-order -num-shuffles=5
; CHECK: @llvm.global_ctors = appending global [0 x { i32, void ()*, i8* }] zeroinitializer

View File

@ -1,6 +1,7 @@
; Test to make sure loop vectorizer metadata is automatically upgraded.
;
; RUN: llvm-dis < %s.bc | FileCheck %s
; RUN: llvm-uselistorder < %s.bc -preserve-bc-use-list-order -num-shuffles=5
define void @_Z28loop_with_vectorize_metadatav() {
entry:

View File

@ -1,4 +1,5 @@
; RUN: llvm-as < %s | llvm-dis | FileCheck %s
; RUN: llvm-uselistorder < %s -preserve-bc-use-list-order -num-shuffles=5
; Function Attrs: nounwind
define void @_Z4testPiPf(i32* nocapture %pI, float* nocapture %pF) #0 {

View File

@ -1,4 +1,5 @@
; RUN: llvm-dis < %s.bc| FileCheck %s
; RUN: llvm-uselistorder < %s.bc -preserve-bc-use-list-order -num-shuffles=5
; vectorOperations.3.2.ll.bc was generated by passing this file to llvm-as-3.2.
; The test checks that LLVM does not misread vector operations of

View File

@ -1,4 +1,5 @@
; RUN: llvm-dis < %s.bc| FileCheck %s
; RUN: llvm-uselistorder < %s.bc -preserve-bc-use-list-order -num-shuffles=5
; visibility-styles.3.2.ll.bc was generated by passing this file to llvm-as-3.2.
; The test checks that LLVM does not silently misread visibility styles of

View File

@ -1,4 +1,5 @@
; RUN: llvm-dis < %s.bc | FileCheck %s
; RUN: llvm-uselistorder < %s.bc -preserve-bc-use-list-order -num-shuffles=5
; cmpxchg-upgrade.ll.bc was produced by running a version of llvm-as from just
; before the IR change on this file.