Test source: git
Source: <stdin>
-- 1. PGOIndirectCallPromotion
-- 2. PGOIndirectCallPromotion
----------------------------------------
define i64 @func2(i64 %a) {
#0:
ret i64 undef
}
Transformation seems to be correct! (syntactically equal)
----------------------------------------
define ptr @func4(ptr %a) {
#0:
ret ptr undef
}
Transformation seems to be correct! (syntactically equal)
----------------------------------------
@foo = global 8 bytes, align 8
define ptr @bar(ptr %arg) {
#0:
%tmp = load ptr, ptr @foo, align 8
%call = call ptr %tmp(nonnull ptr %arg) noalias
ret ptr %call
}
=>
declare ptr @func4(ptr)
declare i64 @func2(i64)
@foo = global 8 bytes, align 8
@func4 = constant ? bytes, align 8
@func2 = constant ? bytes, align 8
define ptr @bar(ptr %arg) {
#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 = ptrtoint ptr %arg to i64
%#4 = call i64 @func2(i64 %#3)
%#5 = int2ptr i64 %#4 to ptr
br label %if.end.icp3
if.false.orig_indirect2:
%call = call ptr %tmp(nonnull ptr %arg) noalias
br label %if.end.icp3
if.end.icp3:
%#6 = phi ptr [ %call, %if.false.orig_indirect2 ], [ %#5, %if.true.direct_targ1 ]
br label %if.end.icp
if.true.direct_targ:
%#7 = call ptr @func4(nonnull ptr %arg) noalias
br label %if.end.icp
if.end.icp:
%#8 = phi ptr [ %#6, %if.end.icp3 ], [ %#7, %if.true.direct_targ ]
ret ptr %#8
}
Transformation doesn't verify! (unsound)
ERROR: Source is more defined than target
Example:
ptr %arg = null
Source:
ptr %tmp = phy-ptr(addr=128) / Address=#x0000000000000080
ptr %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=128), byte offset=0
Block 2 > size: 9 align: 8 alloc type: 0 alive: true address: 128 const
Contents:
*: phy-ptr(addr=128), byte offset=0
Block 3 > size: 8 align: 8 alloc type: 0 alive: true address: 32
Contents:
phy-ptr(addr=128), byte offset=0
Block 4 > size: 1 align: 1 alloc type: 0 alive: true address: 2
Contents:
*: phy-ptr(addr=128), byte offset=0
Block 5 > size: 1 align: 1 alloc type: 0 alive: true address: 1
Contents:
*: phy-ptr(addr=128), byte offset=0
Block 6 > size: 3 align: 1 alloc type: 0 alive: true address: 4
Contents:
*: phy-ptr(addr=128), byte offset=0
Block 7 > size: 4 align: 1 alloc type: 0 alive: true address: 9
Contents:
*: phy-ptr(addr=128), byte offset=0
LOCAL BLOCKS:
Block 8 > size: 0 align: 1 alloc type: 2 alive: false address: 9223372036854775808
Target:
ptr %tmp = phy-ptr(addr=128) / Address=#x0000000000000080
i1 %#1 = #x0 (0)
>> Jump to %if.false.orig_indirect
i1 %#2 = #x1 (1)
>> Jump to %if.true.direct_targ1
i64 %#3 = #x0000000000000000 (0)
Function @func2 triggered UB
TARGET MEMORY STATE
===================
LOCAL BLOCKS:
Block 8 > size: 0 align: 1 alloc type: 2 alive: false address: 9223372036854775808
Block 9 > size: 0 align: 1 alloc type: 2 alive: false address: 9223372036854775808
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' '-tv-smt-to=20000' '-tv-report-dir=/home/nlopes/alive2/build/logs' '-tv-smt-stats'
Wrote bitcode to: "/home/nlopes/alive2/build/logs/in_kPVFANFm_S8kc.bc"
------------------- SMT STATS -------------------
Num queries: 68
Num invalid: 0
Num skips: 0
Num trivial: 6 (8.1%)
Num timeout: 0 (0.0%)
Num errors: 0 (0.0%)
Num SAT: 42 (61.8%)
Num UNSAT: 26 (38.2%)
Alive2: Transform doesn't verify; aborting!
RUN: at line 1: /home/nlopes/alive2/build/opt-alive.sh -S -passes=pgo-icall-prom -icp-total-percent-threshold=0 < /bitbucket/nlopes/llvm/llvm/test/Transforms/Util/call-promotion-utils-ptrcast-attribute.ll 2>&1 | /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/Util/call-promotion-utils-ptrcast-attribute.ll
+ /home/nlopes/alive2/build/opt-alive.sh -S -passes=pgo-icall-prom -icp-total-percent-threshold=0
+ /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/Util/call-promotion-utils-ptrcast-attribute.ll
/bitbucket/nlopes/llvm/llvm/test/Transforms/Util/call-promotion-utils-ptrcast-attribute.ll:22:10: error: CHECK: expected string not found in input
; CHECK: call noalias ptr @func4(ptr nonnull
^
<stdin>:1:1: note: scanning from here
^
<stdin>:1:40: note: possible intended match here
^
Input file: <stdin>
Check file: /bitbucket/nlopes/llvm/llvm/test/Transforms/Util/call-promotion-utils-ptrcast-attribute.ll
-dump-input=help explains the following input dump.
Input was:
<<<<<<
1:
check:22'0 X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
check:22'1 ? possible intended match
>>>>>>