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=#x009
ptr %p2 = pointer(non-local, block_id=1, offset=0) / Address=#x009

Source:
ptr %tmp = pointer(local, block_id=0, offset=0) / Address=#x100

SOURCE MEMORY STATE
===================
NON-LOCAL BLOCKS:
Block 0 >	size: 0	align: 1	alloc type: 0	alive: false	address: 0
Block 1 >	size: 8	align: 1	alloc type: 0	alive: true	address: 9
Contents:
0: #x00
6: #x00
1: #x00
3: #x04
2: #x00
*: poison

Block 2 >	size: 0	align: 1	alloc type: 0	alive: true	address: 2
Contents:
3: poison
*: poison


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

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

Mismatch in pointer(non-local, block_id=1, offset=3)
Source value: #x04
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_h0dYtjX3_p60I.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:     22 (62.9%)
Num UNSAT:   13 (37.1%)
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