Test Failure: Transforms/Util/call-promotion-utils-ptrcast.ll

Test source: git

Log:

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

----------------------------------------
define i64 @func1(ptr %a) {
#0:
  ret i64 undef
}
Transformation seems to be correct! (syntactically equal)


----------------------------------------
define ptr @func2(i64 %a) {
#0:
  ret ptr undef
}
Transformation seems to be correct! (syntactically equal)


----------------------------------------
define ptr @func3(ptr %a) {
#0:
  ret ptr undef
}
Transformation seems to be correct! (syntactically equal)


----------------------------------------
define ptr @func4(double %f) {
#0:
  ret ptr undef
}
Transformation seems to be correct! (syntactically equal)


----------------------------------------
@foo = global 8 bytes, align 8

define i64 @bar() {
#0:
  %tmp = load ptr, ptr @foo, align 8
  %call = call i64 %tmp(i64 1)
  ret i64 %call
}
=>
declare ptr @func4(double)
declare ptr @func2(i64)
declare ptr @func3(ptr)
declare i64 @func1(ptr)

@foo = global 8 bytes, align 8
@func4 = constant ? bytes, exec, align 8
@func2 = constant ? bytes, exec, align 8
@func3 = constant ? bytes, exec, align 8
@func1 = constant ? bytes, exec, align 8

define i64 @bar() {
#0:
  %tmp = load ptr, ptr @foo, align 8
  %#1 = icmp eq ptr %tmp, @func4
  br i1 %#1, label %if.true.direct_targ, label %if.false.orig_indirect

if.false.orig_indirect:
  %#2 = icmp eq ptr %tmp, @func2
  br i1 %#2, label %if.true.direct_targ1, label %if.false.orig_indirect2

if.true.direct_targ1:
  %#3 = call ptr @func2(i64 1)
  %#4 = ptrtoint ptr %#3 to i64
  br label %if.end.icp3

if.false.orig_indirect2:
  %#5 = icmp eq ptr %tmp, @func3
  br i1 %#5, label %if.true.direct_targ4, label %if.false.orig_indirect5

if.true.direct_targ4:
  %#6 = int2ptr i64 1 to ptr
  %#7 = call ptr @func3(ptr %#6)
  %#8 = ptrtoint ptr %#7 to i64
  br label %if.end.icp6

if.false.orig_indirect5:
  %#9 = icmp eq ptr %tmp, @func1
  br i1 %#9, label %if.true.direct_targ7, label %if.false.orig_indirect8

if.true.direct_targ7:
  %#10 = int2ptr i64 1 to ptr
  %#11 = call i64 @func1(ptr %#10)
  br label %if.end.icp9

if.false.orig_indirect8:
  %call = call i64 %tmp(i64 1)
  br label %if.end.icp9

if.end.icp9:
  %#12 = phi i64 [ %call, %if.false.orig_indirect8 ], [ %#11, %if.true.direct_targ7 ]
  br label %if.end.icp6

if.end.icp6:
  %#13 = phi i64 [ %#12, %if.end.icp9 ], [ %#8, %if.true.direct_targ4 ]
  br label %if.end.icp3

if.end.icp3:
  %#14 = phi i64 [ %#13, %if.end.icp6 ], [ %#4, %if.true.direct_targ1 ]
  br label %if.end.icp

if.true.direct_targ:
  %#15 = bitcast i64 1 to double
  %#16 = call ptr @func4(double %#15)
  %#17 = ptrtoint ptr %#16 to i64
  br label %if.end.icp

if.end.icp:
  %#18 = phi i64 [ %#14, %if.end.icp3 ], [ %#17, %if.true.direct_targ ]
  ret i64 %#18
}
Transformation doesn't verify! (unsound)
ERROR: Source is more defined than target

Example:

Source:
ptr %tmp = phy-ptr(addr=192) / Address=#x00000000000000c0
i64 %call = function did not return!

SOURCE MEMORY STATE
===================
NON-LOCAL BLOCKS:
Block 0 >	size: 0	align: 8	alloc type: 0	alive: false	address: 0
Block 1 >	size: 1	align: 8	alloc type: 0	alive: true	address: 8	const
Contents:
*: phy-ptr(addr=192), byte offset=0

Block 2 >	size: 1	align: 8	alloc type: 0	alive: true	address: 128	const
Contents:
*: phy-ptr(addr=192), byte offset=0

Block 3 >	size: 9	align: 8	alloc type: 0	alive: true	address: 40	const
Contents:
*: phy-ptr(addr=192), byte offset=0

Block 4 >	size: 1	align: 8	alloc type: 0	alive: true	address: 192	const
Contents:
*: phy-ptr(addr=192), byte offset=0

Block 5 >	size: 8	align: 8	alloc type: 0	alive: true	address: 32
Contents:
phy-ptr(addr=192), byte offset=0

Block 6 >	size: 0	align: 1	alloc type: 0	alive: true	address: 1
Contents:
*: phy-ptr(addr=192), byte offset=0

Block 7 >	size: 0	align: 1	alloc type: 0	alive: true	address: 8
Contents:
*: phy-ptr(addr=192), byte offset=0

Block 8 >	size: 0	align: 4	alloc type: 0	alive: true	address: 8
Contents:
*: phy-ptr(addr=192), byte offset=0


Target:
ptr %tmp = phy-ptr(addr=192) / Address=#x00000000000000c0
i1 %#1 = #x0 (0)
  >> Jump to %if.false.orig_indirect
i1 %#2 = #x0 (0)
  >> Jump to %if.false.orig_indirect2
i1 %#5 = #x0 (0)
  >> Jump to %if.false.orig_indirect5
i1 %#9 = #x1 (1)
  >> Jump to %if.true.direct_targ7
ptr %#10 = phy-ptr(addr=1) / Address=#x0000000000000001
Function @func1 triggered UB


Pass: PGOIndirectCallPromotion
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' '-passes=pgo-icall-prom' '-icp-total-percent-threshold=0' '-icp-max-prom=4' '-tv-smt-to=20000' '-tv-report-dir=/home/nlopes/alive2/build/logs' '-tv-smt-stats'
Wrote bitcode to: "/home/nlopes/alive2/build/logs/in_VIQvRsBY_XYJb.bc"


------------------- SMT STATS -------------------
Num queries: 64
Num invalid: 0
Num skips:   0
Num trivial: 7 (9.9%)
Num timeout: 0 (0.0%)
Num errors:  0 (0.0%)
Num SAT:     30 (46.9%)
Num UNSAT:   34 (53.1%)
Alive2: Transform doesn't verify; aborting!

stderr:

RUN: at line 1: /home/nlopes/alive2/build/opt-alive.sh -S -passes=pgo-icall-prom -icp-total-percent-threshold=0 -icp-max-prom=4 < /bitbucket/nlopes/llvm/llvm/test/Transforms/Util/call-promotion-utils-ptrcast.ll 2>&1 | /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/Util/call-promotion-utils-ptrcast.ll
+ /home/nlopes/alive2/build/opt-alive.sh -S -passes=pgo-icall-prom -icp-total-percent-threshold=0 -icp-max-prom=4
+ /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/Util/call-promotion-utils-ptrcast.ll
/bitbucket/nlopes/llvm/llvm/test/Transforms/Util/call-promotion-utils-ptrcast.ll:30:10: error: CHECK: expected string not found in input
; CHECK: [[ARG:%[0-9]+]] = bitcast i64 1 to double
         ^
<stdin>:1:1: note: scanning from here

^

Input file: <stdin>
Check file: /bitbucket/nlopes/llvm/llvm/test/Transforms/Util/call-promotion-utils-ptrcast.ll

-dump-input=help explains the following input dump.

Input was:
<<<<<<
          1:  
check:30     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
>>>>>>

 

<-- Back