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. 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)

-- 3. 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)

-- 4. 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)

-- 5. 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)

-- 6. 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)

-- 7. 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)

-- 8. 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)

-- 9. 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)

-- 10. PassManager<Function> : Skipping NOP
-- 11. PassManager<Function> : Skipping NOP
-- 12. 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)

-- 13. 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)

-- 14. 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)

-- 15. 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)

-- 16. 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)

-- 17. 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)

-- 18. 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)

-- 19. 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)

-- 20. 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)

-- 21. PassManager<Function> : Skipping NOP
-- 22. 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)

-- 23. 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)

-- 24. 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)

-- 25. 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)
ptr %p2 = pointer(non-local, block_id=1, offset=0)

Source:
ptr %tmp = null

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

Block 2 >	size: 1	align: 1	alloc type: 0	alive: true	address: 2
Contents:
6: poison
3: poison
0: #x04
2: poison
1: poison
4: #x00
5: #x24
*: 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: #x00
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_ua94blvN_h3uU.bc"


------------------- SMT STATS -------------------
Num queries: 32
Num invalid: 0
Num skips:   0
Num trivial: 7 (17.9%)
Num timeout: 0 (0.0%)
Num errors:  0 (0.0%)
Num SAT:     18 (56.2%)
Num UNSAT:   14 (43.8%)
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