Test Failure: Transforms/InstCombine/malloc-free.ll

Test source: git

Log:

Source: <stdin>
-- 1. ModuleToFunctionPassAdaptor
ERROR: Unsupported instruction:   store volatile i8 4, ptr %g, align 1
ERROR: Unsupported attribute: nofree
ERROR: Unsupported attribute: nofree
-- 1. PassManager<Function> : Skipping NOP
-- 2. InstCombinePass

----------------------------------------
declare ptr @malloc(i32)
declare void @free(ptr)

define i32 @main(i32 %argc, ptr %argv) {
#0:
  %c_19 = alloca i64 4, align 4
  %__constexpr_2 = gep ptr null, 1 x i32 1
  %__constexpr_1 = ptrtoint ptr %__constexpr_2 to i32
  %__constexpr_0 = mul i32 %__constexpr_1, 10
  %malloc_206 = call ptr @malloc(noundef i32 %__constexpr_0) nofree noundef nothrow noalias willreturn alloc-family(malloc) allockind(alloc, uninitialized) allocsize(0) memory(inaccessiblemem: readwrite)
  store ptr %malloc_206, ptr %c_19, align 4
  %tmp_207 = load ptr, ptr %c_19, align 4
  call void @free(noundef allocptr ptr %tmp_207) nothrow willreturn alloc-family(malloc) allockind(free) memory(inaccessiblemem: readwrite)
  ret i32 0
}
Transformation seems to be correct! (syntactically equal)

-- 3. InstCombinePass

----------------------------------------
declare ptr @malloc(i32)
declare void @free(ptr)

define i32 @main(i32 %argc, ptr %argv) {
#0:
  %c_19 = alloca i64 4, align 4
  %__constexpr_2 = gep ptr null, 1 x i32 1
  %__constexpr_1 = ptrtoint ptr %__constexpr_2 to i32
  %__constexpr_0 = mul i32 %__constexpr_1, 10
  %malloc_206 = call ptr @malloc(noundef i32 %__constexpr_0) nofree noundef nothrow noalias willreturn alloc-family(malloc) allockind(alloc, uninitialized) allocsize(0) memory(inaccessiblemem: readwrite)
  store ptr %malloc_206, ptr %c_19, align 4
  %tmp_207 = load ptr, ptr %c_19, align 4
  call void @free(noundef allocptr ptr %tmp_207) nothrow willreturn alloc-family(malloc) allockind(free) memory(inaccessiblemem: readwrite)
  ret i32 0
}
=>
define i32 @main(i32 %argc, ptr %argv) {
#0:
  ret i32 0
}
Transformation seems to be correct!

-- 4. PassManager<Function> : Skipping NOP
-- 5. PassManager<Function> : Skipping NOP
-- 6. InstCombinePass

----------------------------------------
declare ptr @aligned_alloc(i32, i32)
declare void @free(ptr)

define i32 @dead_aligned_alloc(i32 %size, i32 %alignment, i8 %value) {
#0:
  %aligned_allocation = call ptr @aligned_alloc(noundef allocalign i32 %alignment, noundef i32 %size) nofree noundef nothrow noalias willreturn alloc-family(malloc) allockind(alloc, uninitialized, aligned) allocsize(1) memory(inaccessiblemem: readwrite)
  store i8 %value, ptr %aligned_allocation, align 1
  call void @free(noundef allocptr ptr %aligned_allocation) nothrow willreturn alloc-family(malloc) allockind(free) memory(inaccessiblemem: readwrite)
  ret i32 0
}
Transformation seems to be correct! (syntactically equal)

-- 7. InstCombinePass

----------------------------------------
declare ptr @aligned_alloc(i32, i32)
declare void @free(ptr)

define i32 @dead_aligned_alloc(i32 %size, i32 %alignment, i8 %value) {
#0:
  %aligned_allocation = call ptr @aligned_alloc(noundef allocalign i32 %alignment, noundef i32 %size) nofree noundef nothrow noalias willreturn alloc-family(malloc) allockind(alloc, uninitialized, aligned) allocsize(1) memory(inaccessiblemem: readwrite)
  store i8 %value, ptr %aligned_allocation, align 8
  call void @free(noundef allocptr ptr %aligned_allocation) nothrow willreturn alloc-family(malloc) allockind(free) memory(inaccessiblemem: readwrite)
  ret i32 0
}
=>
define i32 @dead_aligned_alloc(i32 %size, i32 %alignment, i8 %value) {
#0:
  ret i32 0
}
Transformation seems to be correct!

-- 8. PassManager<Function> : Skipping NOP
-- 9. PassManager<Function> : Skipping NOP
-- 10. InstCombinePass

----------------------------------------
declare ptr @aligned_alloc(i32, i32)

define i1 @aligned_alloc_only_pointe(i32 %size, i32 %alignment, i8 %value) {
#0:
  %aligned_allocation = call ptr @aligned_alloc(noundef allocalign i32 %alignment, noundef i32 %size) nofree noundef nothrow noalias willreturn alloc-family(malloc) allockind(alloc, uninitialized, aligned) allocsize(1) memory(inaccessiblemem: readwrite)
  %cmp = icmp ne ptr %aligned_allocation, null
  ret i1 %cmp
}
Transformation seems to be correct! (syntactically equal)

-- 11. InstCombinePass

----------------------------------------
declare ptr @aligned_alloc(i32, i32)

define i1 @aligned_alloc_only_pointe(i32 %size, i32 %alignment, i8 %value) {
#0:
  %aligned_allocation = call ptr @aligned_alloc(noundef allocalign i32 %alignment, noundef i32 %size) nofree noundef nothrow noalias willreturn alloc-family(malloc) allockind(alloc, uninitialized, aligned) allocsize(1) memory(inaccessiblemem: readwrite)
  %cmp = icmp ne ptr %aligned_allocation, null
  ret i1 %cmp
}
Transformation seems to be correct! (syntactically equal)

-- 12. PassManager<Function> : Skipping NOP
-- 13. PassManager<Function> : Skipping NOP
-- 14. InstCombinePass

----------------------------------------
declare ptr @aligned_alloc(i32, i32)

define i1 @aligned_alloc_pointer_only_used_by_cmp_alignment_and_value_known_ok(i32 %size, i32 %alignment, i8 %value) {
#0:
  %aligned_allocation = call ptr @aligned_alloc(noundef allocalign i32 8, noundef i32 32) nofree noundef nothrow noalias willreturn dereferenceable_or_null(32) alloc-family(malloc) allockind(alloc, uninitialized, aligned) allocsize(1) memory(inaccessiblemem: readwrite)
  %cmp = icmp ne ptr %aligned_allocation, null
  ret i1 %cmp
}
Transformation seems to be correct! (syntactically equal)

-- 15. InstCombinePass

----------------------------------------
declare ptr @aligned_alloc(i32, i32)

define i1 @aligned_alloc_pointer_only_used_by_cmp_alignment_and_value_known_ok(i32 %size, i32 %alignment, i8 %value) {
#0:
  %aligned_allocation = call ptr @aligned_alloc(noundef allocalign i32 8, noundef i32 32) nofree noundef nothrow noalias willreturn dereferenceable_or_null(32) alloc-family(malloc) allockind(alloc, uninitialized, aligned) allocsize(1) memory(inaccessiblemem: readwrite)
  %cmp = icmp ne ptr %aligned_allocation, null, use_provenance
  ret i1 %cmp
}
=>
define i1 @aligned_alloc_pointer_only_used_by_cmp_alignment_and_value_known_ok(i32 %size, i32 %alignment, i8 %value) {
#0:
  ret i1 1
}
Transformation seems to be correct!

-- 16. PassManager<Function> : Skipping NOP
-- 17. PassManager<Function> : Skipping NOP
-- 18. InstCombinePass

----------------------------------------
declare ptr @aligned_alloc(i32, i32)

define i1 @aligned_alloc_pointer_only_used_by_cmp_alignment_no_power_of_2(i32 %size, i32 %alignment, i8 %value) {
#0:
  %aligned_allocation = call ptr @aligned_alloc(noundef allocalign i32 3, noundef i32 32) nofree noundef nothrow noalias willreturn dereferenceable_or_null(32) alloc-family(malloc) allockind(alloc, uninitialized, aligned) allocsize(1) memory(inaccessiblemem: readwrite)
  %cmp = icmp ne ptr %aligned_allocation, null
  ret i1 %cmp
}
Transformation seems to be correct! (syntactically equal)

-- 19. InstCombinePass

----------------------------------------
declare ptr @aligned_alloc(i32, i32)

define i1 @aligned_alloc_pointer_only_used_by_cmp_alignment_no_power_of_2(i32 %size, i32 %alignment, i8 %value) {
#0:
  %aligned_allocation = call ptr @aligned_alloc(noundef allocalign i32 3, noundef i32 32) nofree noundef nothrow noalias willreturn dereferenceable_or_null(32) alloc-family(malloc) allockind(alloc, uninitialized, aligned) allocsize(1) memory(inaccessiblemem: readwrite)
  %cmp = icmp ne ptr %aligned_allocation, null
  ret i1 %cmp
}
Transformation seems to be correct! (syntactically equal)

-- 20. PassManager<Function> : Skipping NOP
-- 21. PassManager<Function> : Skipping NOP
-- 22. InstCombinePass

----------------------------------------
declare ptr @aligned_alloc(i32, i32)

define i1 @aligned_alloc_pointer_only_used_by_cmp_size_not_multiple_of_alignment(i32 %size, i32 %alignment, i8 %value) {
#0:
  %aligned_allocation = call ptr @aligned_alloc(noundef allocalign i32 8, noundef i32 31) nofree noundef nothrow noalias willreturn dereferenceable_or_null(31) alloc-family(malloc) allockind(alloc, uninitialized, aligned) allocsize(1) memory(inaccessiblemem: readwrite)
  %cmp = icmp ne ptr %aligned_allocation, null
  ret i1 %cmp
}
Transformation seems to be correct! (syntactically equal)

-- 23. InstCombinePass

----------------------------------------
declare ptr @aligned_alloc(i32, i32)

define i1 @aligned_alloc_pointer_only_used_by_cmp_size_not_multiple_of_alignment(i32 %size, i32 %alignment, i8 %value) {
#0:
  %aligned_allocation = call ptr @aligned_alloc(noundef allocalign i32 8, noundef i32 31) nofree noundef nothrow noalias willreturn dereferenceable_or_null(31) alloc-family(malloc) allockind(alloc, uninitialized, aligned) allocsize(1) memory(inaccessiblemem: readwrite)
  %cmp = icmp ne ptr %aligned_allocation, null
  ret i1 %cmp
}
Transformation seems to be correct! (syntactically equal)

-- 24. PassManager<Function> : Skipping NOP
-- 25. PassManager<Function> : Skipping NOP
-- 26. InstCombinePass

----------------------------------------
declare ptr @other_aligned_alloc(i32, i32)

define i1 @other_aligned_allocation_function(i32 %size, i32 %alignment, i8 %value) {
#0:
  %aligned_allocation = call ptr @other_aligned_alloc(i32 %alignment, i32 %size) noalias alloc-family(malloc) allockind(alloc, uninitialized, aligned) allocsize(1)
  %cmp = icmp ne ptr %aligned_allocation, null
  ret i1 %cmp
}
Transformation seems to be correct! (syntactically equal)

-- 27. InstCombinePass

----------------------------------------
declare ptr @other_aligned_alloc(i32, i32)

define i1 @other_aligned_allocation_function(i32 %size, i32 %alignment, i8 %value) {
#0:
  %aligned_allocation = call ptr @other_aligned_alloc(i32 %alignment, i32 %size) noalias alloc-family(malloc) allockind(alloc, uninitialized, aligned) allocsize(1)
  %cmp = icmp ne ptr %aligned_allocation, null
  ret i1 %cmp
}
=>
define i1 @other_aligned_allocation_function(i32 %size, i32 %alignment, i8 %value) {
#0:
  ret i1 1
}
Transformation doesn't verify! (unsound)
ERROR: Value mismatch

Example:
i32 %size = #x80000008 (2147483656, -2147483640)
i32 %alignment = poison
i8 %value = poison

Source:
ptr %aligned_allocation = null
i1 %cmp = #x0 (0)

SOURCE MEMORY STATE
===================
NON-LOCAL BLOCKS:
Block 0 >	size: 0	align: 1	alloc type: 0	alive: false	address: 0

LOCAL BLOCKS:
Block 2 >	size: 8	align: 8	alloc type: 2	alive: false

Target:
Source value: #x0 (0)
Target value: #x1 (1)

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' '-passes=instcombine' '-S' '-tv-smt-to=20000' '-tv-report-dir=/home/nlopes/alive2/build/logs' '-tv-smt-stats'
Wrote bitcode to: "/home/nlopes/alive2/build/logs/in_0OkbU4fx_Yotp.bc"


------------------- SMT STATS -------------------
Num queries: 24
Num invalid: 0
Num skips:   0
Num trivial: 25 (51.0%)
Num timeout: 0 (0.0%)
Num errors:  0 (0.0%)
Num SAT:     18 (75.0%)
Num UNSAT:   6 (25.0%)
Alive2: Transform doesn't verify; aborting!

stderr:

RUN: at line 2: /home/nlopes/alive2/build/opt-alive.sh < /bitbucket/nlopes/llvm/llvm/test/Transforms/InstCombine/malloc-free.ll -passes=instcombine -S | /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/InstCombine/malloc-free.ll
+ /home/nlopes/alive2/build/opt-alive.sh -passes=instcombine -S
+ /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/InstCombine/malloc-free.ll

FileCheck error: '<stdin>' is empty.
FileCheck command line:  /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/InstCombine/malloc-free.ll

 

<-- Back