Test Failure: Transforms/PhaseOrdering/swap-promotion.ll

Test source: git

Comments: LLVM bug: load type punning. needs byte type

Log:

Source: <stdin>
-- 1. Annotation2MetadataPass
-- 2. Annotation2MetadataPass

----------------------------------------
define void @swap(ptr %p1, ptr %p2) {
#0:
  %tmp = alloca i64 8, align 4
  memcpy ptr %tmp align 1, ptr %p1 align 1, i64 8
  memcpy ptr %p1 align 1, ptr %p2 align 1, i64 8
  memcpy ptr %p2 align 1, ptr %tmp align 1, i64 8
  ret void
}
Transformation seems to be correct! (syntactically equal)


----------------------------------------
declare void @swap(ptr, ptr)

define i32 @test(i32 %n) {
#0:
  %p1 = alloca i64 8, align 4
  %p2 = alloca i64 8, align 4
  %p1.2 = gep ptr %p1, 4 x i64 1
  %p2.2 = gep ptr %p2, 4 x i64 1
  store i32 0, ptr %p1, align 4
  store i32 1, ptr %p1.2, align 4
  br label %loop

loop:
  %v1 = load i32, ptr %p1, align 4
  %v1.inc = add i32 %v1, 1
  store i32 %v1.inc, ptr %p1, align 4
  %v2 = load i32, ptr %p1.2, align 4
  %v2.next = shl i32 %v2, 1
  store i32 %v2.next, ptr %p1.2, align 4
  %c = icmp eq i32 %v1.inc, %n
  br i1 %c, label %exit, label %loop

exit:
  call void @swap(ptr %p1, ptr %p2)
  %res = load i32, ptr %p2.2, align 4
  ret i32 %res
}
Transformation seems to be correct! (syntactically equal)

-- 3. ForceFunctionAttrsPass

----------------------------------------
define void @swap(ptr %p1, ptr %p2) {
#0:
  %tmp = alloca i64 8, align 4
  memcpy ptr %tmp align 1, ptr %p1 align 1, i64 8
  memcpy ptr %p1 align 1, ptr %p2 align 1, i64 8
  memcpy ptr %p2 align 1, ptr %tmp align 1, i64 8
  ret void
}
Transformation seems to be correct! (syntactically equal)


----------------------------------------
declare void @swap(ptr, ptr)

define i32 @test(i32 %n) {
#0:
  %p1 = alloca i64 8, align 4
  %p2 = alloca i64 8, align 4
  %p1.2 = gep ptr %p1, 4 x i64 1
  %p2.2 = gep ptr %p2, 4 x i64 1
  store i32 0, ptr %p1, align 4
  store i32 1, ptr %p1.2, align 4
  br label %loop

loop:
  %v1 = load i32, ptr %p1, align 4
  %v1.inc = add i32 %v1, 1
  store i32 %v1.inc, ptr %p1, align 4
  %v2 = load i32, ptr %p1.2, align 4
  %v2.next = shl i32 %v2, 1
  store i32 %v2.next, ptr %p1.2, align 4
  %c = icmp eq i32 %v1.inc, %n
  br i1 %c, label %exit, label %loop

exit:
  call void @swap(ptr %p1, ptr %p2)
  %res = load i32, ptr %p2.2, align 4
  ret i32 %res
}
Transformation seems to be correct! (syntactically equal)

-- 4. ForceFunctionAttrsPass

----------------------------------------
define void @swap(ptr %p1, ptr %p2) {
#0:
  %tmp = alloca i64 8, align 4
  memcpy ptr %tmp align 1, ptr %p1 align 1, i64 8
  memcpy ptr %p1 align 1, ptr %p2 align 1, i64 8
  memcpy ptr %p2 align 1, ptr %tmp align 1, i64 8
  ret void
}
Transformation seems to be correct! (syntactically equal)


----------------------------------------
declare void @swap(ptr, ptr)

define i32 @test(i32 %n) {
#0:
  %p1 = alloca i64 8, align 4
  %p2 = alloca i64 8, align 4
  %p1.2 = gep ptr %p1, 4 x i64 1
  %p2.2 = gep ptr %p2, 4 x i64 1
  store i32 0, ptr %p1, align 4
  store i32 1, ptr %p1.2, align 4
  br label %loop

loop:
  %v1 = load i32, ptr %p1, align 4
  %v1.inc = add i32 %v1, 1
  store i32 %v1.inc, ptr %p1, align 4
  %v2 = load i32, ptr %p1.2, align 4
  %v2.next = shl i32 %v2, 1
  store i32 %v2.next, ptr %p1.2, align 4
  %c = icmp eq i32 %v1.inc, %n
  br i1 %c, label %exit, label %loop

exit:
  call void @swap(ptr %p1, ptr %p2)
  %res = load i32, ptr %p2.2, align 4
  ret i32 %res
}
Transformation seems to be correct! (syntactically equal)

-- 5. InferFunctionAttrsPass : Skipping unsupported
-- 6. InferFunctionAttrsPass : Skipping unsupported
-- 7. CoroEarlyPass

----------------------------------------
define void @swap(ptr %p1, ptr %p2) {
#0:
  %tmp = alloca i64 8, align 4
  memcpy ptr %tmp align 1, ptr %p1 align 1, i64 8
  memcpy ptr %p1 align 1, ptr %p2 align 1, i64 8
  memcpy ptr %p2 align 1, ptr %tmp align 1, i64 8
  ret void
}
Transformation seems to be correct! (syntactically equal)


----------------------------------------
declare void @swap(ptr, ptr)

define i32 @test(i32 %n) {
#0:
  %p1 = alloca i64 8, align 4
  %p2 = alloca i64 8, align 4
  %p1.2 = gep ptr %p1, 4 x i64 1
  %p2.2 = gep ptr %p2, 4 x i64 1
  store i32 0, ptr %p1, align 4
  store i32 1, ptr %p1.2, align 4
  br label %loop

loop:
  %v1 = load i32, ptr %p1, align 4
  %v1.inc = add i32 %v1, 1
  store i32 %v1.inc, ptr %p1, align 4
  %v2 = load i32, ptr %p1.2, align 4
  %v2.next = shl i32 %v2, 1
  store i32 %v2.next, ptr %p1.2, align 4
  %c = icmp eq i32 %v1.inc, %n
  br i1 %c, label %exit, label %loop

exit:
  call void @swap(ptr %p1, ptr %p2)
  %res = load i32, ptr %p2.2, align 4
  ret i32 %res
}
Transformation seems to be correct! (syntactically equal)

-- 8. CoroEarlyPass

----------------------------------------
define void @swap(ptr %p1, ptr %p2) {
#0:
  %tmp = alloca i64 8, align 4
  memcpy ptr %tmp align 1, ptr %p1 align 1, i64 8
  memcpy ptr %p1 align 1, ptr %p2 align 1, i64 8
  memcpy ptr %p2 align 1, ptr %tmp align 1, i64 8
  ret void
}
Transformation seems to be correct! (syntactically equal)


----------------------------------------
declare void @swap(ptr, ptr)

define i32 @test(i32 %n) {
#0:
  %p1 = alloca i64 8, align 4
  %p2 = alloca i64 8, align 4
  %p1.2 = gep ptr %p1, 4 x i64 1
  %p2.2 = gep ptr %p2, 4 x i64 1
  store i32 0, ptr %p1, align 4
  store i32 1, ptr %p1.2, align 4
  br label %loop

loop:
  %v1 = load i32, ptr %p1, align 4
  %v1.inc = add i32 %v1, 1
  store i32 %v1.inc, ptr %p1, align 4
  %v2 = load i32, ptr %p1.2, align 4
  %v2.next = shl i32 %v2, 1
  store i32 %v2.next, ptr %p1.2, align 4
  %c = icmp eq i32 %v1.inc, %n
  br i1 %c, label %exit, label %loop

exit:
  call void @swap(ptr %p1, ptr %p2)
  %res = load i32, ptr %p2.2, align 4
  ret i32 %res
}
Transformation seems to be correct! (syntactically equal)

-- 9. ModuleToFunctionPassAdaptor

----------------------------------------
define void @swap(ptr %p1, ptr %p2) {
#0:
  %tmp = alloca i64 8, align 4
  memcpy ptr %tmp align 1, ptr %p1 align 1, i64 8
  memcpy ptr %p1 align 1, ptr %p2 align 1, i64 8
  memcpy ptr %p2 align 1, ptr %tmp align 1, i64 8
  ret void
}
Transformation seems to be correct! (syntactically equal)


----------------------------------------
declare void @swap(ptr, ptr)

define i32 @test(i32 %n) {
#0:
  %p1 = alloca i64 8, align 4
  %p2 = alloca i64 8, align 4
  %p1.2 = gep ptr %p1, 4 x i64 1
  %p2.2 = gep ptr %p2, 4 x i64 1
  store i32 0, ptr %p1, align 4
  store i32 1, ptr %p1.2, align 4
  br label %loop

loop:
  %v1 = load i32, ptr %p1, align 4
  %v1.inc = add i32 %v1, 1
  store i32 %v1.inc, ptr %p1, align 4
  %v2 = load i32, ptr %p1.2, align 4
  %v2.next = shl i32 %v2, 1
  store i32 %v2.next, ptr %p1.2, align 4
  %c = icmp eq i32 %v1.inc, %n
  br i1 %c, label %exit, label %loop

exit:
  call void @swap(ptr %p1, ptr %p2)
  %res = load i32, ptr %p2.2, align 4
  ret i32 %res
}
Transformation seems to be correct! (syntactically equal)

-- 1. PassManager<Function> : Skipping NOP
-- 2. EntryExitInstrumenterPass : Skipping unsupported
-- 3. EntryExitInstrumenterPass : Skipping unsupported
-- 4. LowerExpectIntrinsicPass

----------------------------------------
define void @swap(ptr %p1, ptr %p2) {
#0:
  %tmp = alloca i64 8, align 4
  memcpy ptr %tmp align 1, ptr %p1 align 1, i64 8
  memcpy ptr %p1 align 1, ptr %p2 align 1, i64 8
  memcpy ptr %p2 align 1, ptr %tmp align 1, i64 8
  ret void
}
Transformation seems to be correct! (syntactically equal)

-- 5. LowerExpectIntrinsicPass

----------------------------------------
define void @swap(ptr %p1, ptr %p2) {
#0:
  %tmp = alloca i64 8, align 4
  memcpy ptr %tmp align 1, ptr %p1 align 1, i64 8
  memcpy ptr %p1 align 1, ptr %p2 align 1, i64 8
  memcpy ptr %p2 align 1, ptr %tmp align 1, i64 8
  ret void
}
Transformation seems to be correct! (syntactically equal)

-- 6. SimplifyCFGPass

----------------------------------------
define void @swap(ptr %p1, ptr %p2) {
#0:
  %tmp = alloca i64 8, align 4
  memcpy ptr %tmp align 1, ptr %p1 align 1, i64 8
  memcpy ptr %p1 align 1, ptr %p2 align 1, i64 8
  memcpy ptr %p2 align 1, ptr %tmp align 1, i64 8
  ret void
}
Transformation seems to be correct! (syntactically equal)

-- 7. SimplifyCFGPass

----------------------------------------
define void @swap(ptr %p1, ptr %p2) {
#0:
  %tmp = alloca i64 8, align 4
  memcpy ptr %tmp align 1, ptr %p1 align 1, i64 8
  memcpy ptr %p1 align 1, ptr %p2 align 1, i64 8
  memcpy ptr %p2 align 1, ptr %tmp align 1, i64 8
  ret void
}
Transformation seems to be correct! (syntactically equal)

-- 8. SROAPass

----------------------------------------
define void @swap(ptr %p1, ptr %p2) {
#0:
  %tmp = alloca i64 8, align 4
  memcpy ptr %tmp align 1, ptr %p1 align 1, i64 8
  memcpy ptr %p1 align 1, ptr %p2 align 1, i64 8
  memcpy ptr %p2 align 1, ptr %tmp align 1, i64 8
  ret void
}
Transformation seems to be correct! (syntactically equal)

-- 9. SROAPass

----------------------------------------
define void @swap(ptr %p1, ptr %p2) {
#0:
  %tmp = alloca i64 8, align 4
  memcpy ptr %tmp align 1, ptr %p1 align 1, i64 8
  memcpy ptr %p1 align 1, ptr %p2 align 1, i64 8
  memcpy ptr %p2 align 1, ptr %tmp align 1, i64 8
  ret void
}
Transformation seems to be correct! (syntactically equal)

-- 10. EarlyCSEPass

----------------------------------------
define void @swap(ptr %p1, ptr %p2) {
#0:
  %tmp = alloca i64 8, align 4
  memcpy ptr %tmp align 1, ptr %p1 align 1, i64 8
  memcpy ptr %p1 align 1, ptr %p2 align 1, i64 8
  memcpy ptr %p2 align 1, ptr %tmp align 1, i64 8
  ret void
}
Transformation seems to be correct! (syntactically equal)

-- 11. EarlyCSEPass

----------------------------------------
define void @swap(ptr %p1, ptr %p2) {
#0:
  %tmp = alloca i64 8, align 4
  memcpy ptr %tmp align 1, ptr %p1 align 1, i64 8
  memcpy ptr %p1 align 1, ptr %p2 align 1, i64 8
  memcpy ptr %p2 align 1, ptr %tmp align 1, i64 8
  ret void
}
Transformation seems to be correct! (syntactically equal)

-- 12. PassManager<Function> : Skipping NOP
-- 13. PassManager<Function> : Skipping NOP
-- 14. EntryExitInstrumenterPass : Skipping unsupported
-- 15. EntryExitInstrumenterPass : Skipping unsupported
-- 16. LowerExpectIntrinsicPass

----------------------------------------
declare void @swap(ptr, ptr)

define i32 @test(i32 %n) {
#0:
  %p1 = alloca i64 8, align 4
  %p2 = alloca i64 8, align 4
  %p1.2 = gep ptr %p1, 4 x i64 1
  %p2.2 = gep ptr %p2, 4 x i64 1
  store i32 0, ptr %p1, align 4
  store i32 1, ptr %p1.2, align 4
  br label %loop

loop:
  %v1 = load i32, ptr %p1, align 4
  %v1.inc = add i32 %v1, 1
  store i32 %v1.inc, ptr %p1, align 4
  %v2 = load i32, ptr %p1.2, align 4
  %v2.next = shl i32 %v2, 1
  store i32 %v2.next, ptr %p1.2, align 4
  %c = icmp eq i32 %v1.inc, %n
  br i1 %c, label %exit, label %loop

exit:
  call void @swap(ptr %p1, ptr %p2)
  %res = load i32, ptr %p2.2, align 4
  ret i32 %res
}
Transformation seems to be correct! (syntactically equal)

-- 17. LowerExpectIntrinsicPass

----------------------------------------
declare void @swap(ptr, ptr)

define i32 @test(i32 %n) {
#0:
  %p1 = alloca i64 8, align 4
  %p2 = alloca i64 8, align 4
  %p1.2 = gep ptr %p1, 4 x i64 1
  %p2.2 = gep ptr %p2, 4 x i64 1
  store i32 0, ptr %p1, align 4
  store i32 1, ptr %p1.2, align 4
  br label %loop

loop:
  %v1 = load i32, ptr %p1, align 4
  %v1.inc = add i32 %v1, 1
  store i32 %v1.inc, ptr %p1, align 4
  %v2 = load i32, ptr %p1.2, align 4
  %v2.next = shl i32 %v2, 1
  store i32 %v2.next, ptr %p1.2, align 4
  %c = icmp eq i32 %v1.inc, %n
  br i1 %c, label %exit, label %loop

exit:
  call void @swap(ptr %p1, ptr %p2)
  %res = load i32, ptr %p2.2, align 4
  ret i32 %res
}
Transformation seems to be correct! (syntactically equal)

-- 18. SimplifyCFGPass

----------------------------------------
declare void @swap(ptr, ptr)

define i32 @test(i32 %n) {
#0:
  %p1 = alloca i64 8, align 4
  %p2 = alloca i64 8, align 4
  %p1.2 = gep ptr %p1, 4 x i64 1
  %p2.2 = gep ptr %p2, 4 x i64 1
  store i32 0, ptr %p1, align 4
  store i32 1, ptr %p1.2, align 4
  br label %loop

loop:
  %v1 = load i32, ptr %p1, align 4
  %v1.inc = add i32 %v1, 1
  store i32 %v1.inc, ptr %p1, align 4
  %v2 = load i32, ptr %p1.2, align 4
  %v2.next = shl i32 %v2, 1
  store i32 %v2.next, ptr %p1.2, align 4
  %c = icmp eq i32 %v1.inc, %n
  br i1 %c, label %exit, label %loop

exit:
  call void @swap(ptr %p1, ptr %p2)
  %res = load i32, ptr %p2.2, align 4
  ret i32 %res
}
Transformation seems to be correct! (syntactically equal)

-- 19. SimplifyCFGPass

----------------------------------------
declare void @swap(ptr, ptr)

define i32 @test(i32 %n) {
#0:
  %p1 = alloca i64 8, align 4
  %p2 = alloca i64 8, align 4
  %p1.2 = gep ptr %p1, 4 x i64 1
  %p2.2 = gep ptr %p2, 4 x i64 1
  store i32 0, ptr %p1, align 4
  store i32 1, ptr %p1.2, align 4
  br label %loop

loop:
  %v1 = load i32, ptr %p1, align 4
  %v1.inc = add i32 %v1, 1
  store i32 %v1.inc, ptr %p1, align 4
  %v2 = load i32, ptr %p1.2, align 4
  %v2.next = shl i32 %v2, 1
  store i32 %v2.next, ptr %p1.2, align 4
  %c = icmp eq i32 %v1.inc, %n
  br i1 %c, label %exit, label %loop

exit:
  call void @swap(ptr %p1, ptr %p2)
  %res = load i32, ptr %p2.2, align 4
  ret i32 %res
}
Transformation seems to be correct! (syntactically equal)

-- 20. SROAPass

----------------------------------------
declare void @swap(ptr, ptr)

define i32 @test(i32 %n) {
#0:
  %p1 = alloca i64 8, align 4
  %p2 = alloca i64 8, align 4
  %p1.2 = gep ptr %p1, 4 x i64 1
  %p2.2 = gep ptr %p2, 4 x i64 1
  store i32 0, ptr %p1, align 4
  store i32 1, ptr %p1.2, align 4
  br label %loop

loop:
  %v1 = load i32, ptr %p1, align 4
  %v1.inc = add i32 %v1, 1
  store i32 %v1.inc, ptr %p1, align 4
  %v2 = load i32, ptr %p1.2, align 4
  %v2.next = shl i32 %v2, 1
  store i32 %v2.next, ptr %p1.2, align 4
  %c = icmp eq i32 %v1.inc, %n
  br i1 %c, label %exit, label %loop

exit:
  call void @swap(ptr %p1, ptr %p2)
  %res = load i32, ptr %p2.2, align 4
  ret i32 %res
}
Transformation seems to be correct! (syntactically equal)

-- 21. SROAPass

----------------------------------------
declare void @swap(ptr, ptr)

define i32 @test(i32 %n) {
#0:
  %p1 = alloca i64 8, align 4
  %p2 = alloca i64 8, align 4
  %p1.2 = gep ptr %p1, 4 x i64 1
  %p2.2 = gep ptr %p2, 4 x i64 1
  store i32 0, ptr %p1, align 4
  store i32 1, ptr %p1.2, align 4
  br label %loop

loop:
  %v1 = load i32, ptr %p1, align 4
  %v1.inc = add i32 %v1, 1
  store i32 %v1.inc, ptr %p1, align 4
  %v2 = load i32, ptr %p1.2, align 4
  %v2.next = shl i32 %v2, 1
  store i32 %v2.next, ptr %p1.2, align 4
  %c = icmp eq i32 %v1.inc, %n
  br i1 %c, label %exit, label %loop

exit:
  call void @swap(ptr %p1, ptr %p2)
  %res = load i32, ptr %p2.2, align 4
  ret i32 %res
}
Transformation seems to be correct! (syntactically equal)

-- 22. EarlyCSEPass

----------------------------------------
declare void @swap(ptr, ptr)

define i32 @test(i32 %n) {
#0:
  %p1 = alloca i64 8, align 4
  %p2 = alloca i64 8, align 4
  %p1.2 = gep ptr %p1, 4 x i64 1
  %p2.2 = gep ptr %p2, 4 x i64 1
  store i32 0, ptr %p1, align 4
  store i32 1, ptr %p1.2, align 4
  br label %loop

loop:
  %v1 = load i32, ptr %p1, align 4
  %v1.inc = add i32 %v1, 1
  store i32 %v1.inc, ptr %p1, align 4
  %v2 = load i32, ptr %p1.2, align 4
  %v2.next = shl i32 %v2, 1
  store i32 %v2.next, ptr %p1.2, align 4
  %c = icmp eq i32 %v1.inc, %n
  br i1 %c, label %exit, label %loop

exit:
  call void @swap(ptr %p1, ptr %p2)
  %res = load i32, ptr %p2.2, align 4
  ret i32 %res
}
Transformation seems to be correct! (syntactically equal)

-- 23. EarlyCSEPass

----------------------------------------
declare void @swap(ptr, ptr)

define i32 @test(i32 %n) {
#0:
  %p1 = alloca i64 8, align 4
  %p2 = alloca i64 8, align 4
  %p1.2 = gep ptr %p1, 4 x i64 1
  %p2.2 = gep ptr %p2, 4 x i64 1
  store i32 0, ptr %p1, align 4
  store i32 1, ptr %p1.2, align 4
  br label %loop

loop:
  %v1 = load i32, ptr %p1, align 4
  %v1.inc = add i32 %v1, 1
  store i32 %v1.inc, ptr %p1, align 4
  %v2 = load i32, ptr %p1.2, align 4
  %v2.next = shl i32 %v2, 1
  store i32 %v2.next, ptr %p1.2, align 4
  %c = icmp eq i32 %v1.inc, %n
  br i1 %c, label %exit, label %loop

exit:
  call void @swap(ptr %p1, ptr %p2)
  %res = load i32, ptr %p2.2, align 4
  ret i32 %res
}
Transformation seems to be correct! (syntactically equal)

-- 24. PassManager<Function> : Skipping NOP
-- 10. ModuleToFunctionPassAdaptor

----------------------------------------
define void @swap(ptr %p1, ptr %p2) {
#0:
  %tmp = alloca i64 8, align 4
  memcpy ptr %tmp align 1, ptr %p1 align 1, i64 8
  memcpy ptr %p1 align 1, ptr %p2 align 1, i64 8
  memcpy ptr %p2 align 1, ptr %tmp align 1, i64 8
  ret void
}
Transformation seems to be correct! (syntactically equal)


----------------------------------------
declare void @swap(ptr, ptr)

define i32 @test(i32 %n) {
#0:
  %p1 = alloca i64 8, align 4
  %p2 = alloca i64 8, align 4
  %p1.2 = gep ptr %p1, 4 x i64 1
  %p2.2 = gep ptr %p2, 4 x i64 1
  store i32 0, ptr %p1, align 4
  store i32 1, ptr %p1.2, align 4
  br label %loop

loop:
  %v1 = load i32, ptr %p1, align 4
  %v1.inc = add i32 %v1, 1
  store i32 %v1.inc, ptr %p1, align 4
  %v2 = load i32, ptr %p1.2, align 4
  %v2.next = shl i32 %v2, 1
  store i32 %v2.next, ptr %p1.2, align 4
  %c = icmp eq i32 %v1.inc, %n
  br i1 %c, label %exit, label %loop

exit:
  call void @swap(ptr %p1, ptr %p2)
  %res = load i32, ptr %p2.2, align 4
  ret i32 %res
}
Transformation seems to be correct! (syntactically equal)

-- 11. OpenMPOptPass : Skipping unsupported
-- 12. OpenMPOptPass : Skipping unsupported
-- 13. IPSCCPPass : Skipping unsupported
-- 14. IPSCCPPass : Skipping unsupported
-- 15. CalledValuePropagationPass : Skipping unsupported
-- 16. CalledValuePropagationPass : Skipping unsupported
-- 17. GlobalOptPass : Skipping unsupported
-- 18. GlobalOptPass : Skipping unsupported
-- 19. ModuleToFunctionPassAdaptor

----------------------------------------
define void @swap(ptr %p1, ptr %p2) {
#0:
  %tmp = alloca i64 8, align 4
  memcpy ptr %tmp align 1, ptr %p1 align 1, i64 8
  memcpy ptr %p1 align 1, ptr %p2 align 1, i64 8
  memcpy ptr %p2 align 1, ptr %tmp align 1, i64 8
  ret void
}
Transformation seems to be correct! (syntactically equal)


----------------------------------------
declare void @swap(ptr, ptr)

define i32 @test(i32 %n) {
#0:
  %p1 = alloca i64 8, align 4
  %p2 = alloca i64 8, align 4
  %p1.2 = gep ptr %p1, 4 x i64 1
  %p2.2 = gep ptr %p2, 4 x i64 1
  store i32 0, ptr %p1, align 4
  store i32 1, ptr %p1.2, align 4
  br label %loop

loop:
  %v1 = load i32, ptr %p1, align 4
  %v1.inc = add i32 %v1, 1
  store i32 %v1.inc, ptr %p1, align 4
  %v2 = load i32, ptr %p1.2, align 4
  %v2.next = shl i32 %v2, 1
  store i32 %v2.next, ptr %p1.2, align 4
  %c = icmp eq i32 %v1.inc, %n
  br i1 %c, label %exit, label %loop

exit:
  call void @swap(ptr %p1, ptr %p2)
  %res = load i32, ptr %p2.2, align 4
  ret i32 %res
}
Transformation seems to be correct! (syntactically equal)

-- 25. PassManager<Function> : Skipping NOP
-- 26. PromotePass

----------------------------------------
define void @swap(ptr %p1, ptr %p2) {
#0:
  %tmp = alloca i64 8, align 4
  memcpy ptr %tmp align 1, ptr %p1 align 1, i64 8
  memcpy ptr %p1 align 1, ptr %p2 align 1, i64 8
  memcpy ptr %p2 align 1, ptr %tmp align 1, i64 8
  ret void
}
Transformation seems to be correct! (syntactically equal)

-- 27. PromotePass

----------------------------------------
define void @swap(ptr %p1, ptr %p2) {
#0:
  %tmp = alloca i64 8, align 4
  memcpy ptr %tmp align 1, ptr %p1 align 1, i64 8
  memcpy ptr %p1 align 1, ptr %p2 align 1, i64 8
  memcpy ptr %p2 align 1, ptr %tmp align 1, i64 8
  ret void
}
Transformation seems to be correct! (syntactically equal)

-- 28. InstCombinePass

----------------------------------------
define void @swap(ptr %p1, ptr %p2) {
#0:
  %tmp = alloca i64 8, align 4
  memcpy ptr %tmp align 1, ptr %p1 align 1, i64 8
  memcpy ptr %p1 align 1, ptr %p2 align 1, i64 8
  memcpy ptr %p2 align 1, ptr %tmp align 1, i64 8
  ret void
}
Transformation seems to be correct! (syntactically equal)

-- 29. InstCombinePass

----------------------------------------
define void @swap(ptr %p1, ptr %p2) {
#0:
  %tmp = alloca i64 8, align 4
  memcpy ptr %tmp align 4, ptr %p1 align 1, i64 8
  memcpy ptr %p1 align 1, ptr %p2 align 1, i64 8
  memcpy ptr %p2 align 1, ptr %tmp align 4, i64 8
  ret void
}
=>
define void @swap(ptr %p1, ptr %p2) {
#0:
  %#1 = load i64, ptr %p1, align 1
  %#2 = load i64, ptr %p2, align 1
  store i64 %#2, ptr %p1, align 1
  store i64 %#1, ptr %p2, align 1
  ret void
}
Transformation doesn't verify! (unsound)
ERROR: Mismatch in memory

Example:
ptr %p1 = pointer(non-local, block_id=1, offset=0) / Address=#x008
ptr %p2 = pointer(non-local, block_id=1, offset=0) / Address=#x008

Source:
ptr %tmp = null / Address=#x000

SOURCE MEMORY STATE
===================
NON-LOCAL BLOCKS:
Block 0 >	size: 0	align: 1	alloc type: 0	alive: false	address: 0
Block 1 >	size: 15	align: 1	alloc type: 0	alive: true	address: 8
Contents:
7: #x00
0: pointer(non-local, block_id=0, offset=128), byte offset=0
6: #x00
1: #x02
2: poison
3: #x00
*: poison

Block 2 >	size: 1	align: 1	alloc type: 0	alive: true	address: 4
Contents:
7: poison
0: #x00
6: poison
4: #x80
1: #x00
5: poison
2: poison
3: #x10
*: poison


LOCAL BLOCKS:
Block 4 >	size: 8	align: 4	alloc type: 1	alive: true

Target:
i64 %#1 = poison
i64 %#2 = poison

Mismatch in pointer(non-local, block_id=1, offset=0)
Source value: pointer(non-local, block_id=0, offset=128), byte offset=0
Target value: poison

Pass: InstCombinePass
Command line: '/home/nlopes/llvm/build/bin/opt' '-load=/home/nlopes/alive2/build/tv/tv.so' '-load-pass-plugin=/home/nlopes/alive2/build/tv/tv.so' '-tv-exit-on-error' '-S' '-O1' '-tv-smt-to=20000' '-tv-report-dir=/home/nlopes/alive2/build/logs' '-tv-smt-stats'
Wrote bitcode to: "/home/nlopes/alive2/build/logs/in_vjnUR7dg_cde8.bc"


------------------- SMT STATS -------------------
Num queries: 35
Num invalid: 0
Num skips:   0
Num trivial: 7 (16.7%)
Num timeout: 0 (0.0%)
Num errors:  0 (0.0%)
Num SAT:     21 (60.0%)
Num UNSAT:   14 (40.0%)
Alive2: Transform doesn't verify; aborting!

stderr:

RUN: at line 2: /home/nlopes/alive2/build/opt-alive.sh -S -O1 < /bitbucket/nlopes/llvm/llvm/test/Transforms/PhaseOrdering/swap-promotion.ll | /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/PhaseOrdering/swap-promotion.ll
+ /home/nlopes/alive2/build/opt-alive.sh -S -O1
+ /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/PhaseOrdering/swap-promotion.ll

FileCheck error: '<stdin>' is empty.
FileCheck command line:  /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/PhaseOrdering/swap-promotion.ll

 

<-- Back