Test source: git
Source: <stdin>
-- 1. RequireAnalysisPass<ProfileSummaryAnalysis, Module> : Skipping NOP
-- 2. RequireAnalysisPass<ProfileSummaryAnalysis, Module> : Skipping NOP
-- 3. ModuleToFunctionPassAdaptor
----------------------------------------
define void @Test_no_bypassing(i32 %a, i64 %b, ptr %retptr) {
#0:
%a.1 = zext i32 %a to i64
%a.2 = sub i64 -1, %a.1
%res = srem i64 %a.2, %b
store i64 %res, ptr %retptr, align 8
ret void
}
Transformation seems to be correct! (syntactically equal)
----------------------------------------
define void @Test_check_one_operand(i64 %a, i32 %b, ptr %retptr) {
#0:
%b.1 = zext i32 %b to i64
%res = sdiv i64 %a, %b.1
store i64 %res, ptr %retptr, align 8
ret void
}
Transformation seems to be correct! (syntactically equal)
----------------------------------------
define void @Test_check_none(i64 %a, i32 %b, ptr %retptr) {
#0:
%a.1 = and i64 %a, 4294967295
%b.1 = zext i32 %b to i64
%res = udiv i64 %a.1, %b.1
store i64 %res, ptr %retptr, align 8
ret void
}
Transformation seems to be correct! (syntactically equal)
----------------------------------------
define void @Test_special_case(i32 %a, i64 %b, ptr %retptr) {
#0:
%a.1 = zext i32 %a to i64
%div = udiv i64 %a.1, %b
%rem = urem i64 %a.1, %b
%res = add i64 %div, %rem
store i64 %res, ptr %retptr, align 8
ret void
}
Transformation seems to be correct! (syntactically equal)
----------------------------------------
define void @Test_dont_bypass_xor(i64 %a, i64 %b, i64 %l, ptr %retptr) {
#0:
%c = xor i64 %a, %b
%res = udiv i64 %c, %l
store i64 %res, ptr %retptr, align 8
ret void
}
Transformation seems to be correct! (syntactically equal)
----------------------------------------
define void @Test_dont_bypass_phi_xor(i64 %a, i64 %b, i64 %l, ptr %retptr) {
entry:
%cmp = icmp eq i64 %b, 0
br i1 %cmp, label %merge, label %xorpath
xorpath:
%c = xor i64 %a, %b
br label %merge
merge:
%e = phi i64 [ undef, %entry ], [ %c, %xorpath ]
%res = sdiv i64 %e, %l
store i64 %res, ptr %retptr, align 8
ret void
}
Transformation seems to be correct! (syntactically equal)
----------------------------------------
define void @Test_dont_bypass_mul_long_const(i64 %a, i64 %l, ptr %retptr) {
#0:
%c = mul i64 %a, 5229553307
%res = urem i64 %c, %l
store i64 %res, ptr %retptr, align 8
ret void
}
Transformation seems to be correct! (syntactically equal)
----------------------------------------
define void @Test_bypass_phi_mul_const(i64 %a, i64 %b, ptr %retptr) {
entry:
%a.mul = mul nsw i64 %a, 34806414968801
%p = icmp sgt i64 %a, %b
br i1 %p, label %branch, label %merge
branch:
br label %merge
merge:
%lhs = phi i64 [ 42, %branch ], [ %a.mul, %entry ]
%res = sdiv i64 %lhs, %b
store i64 %res, ptr %retptr, align 8
ret void
}
Transformation seems to be correct! (syntactically equal)
----------------------------------------
define void @Test_bypass_mul_short_const(i64 %a, i64 %l, ptr %retptr) {
#0:
%c = mul i64 %a, -42
%res = urem i64 %c, %l
store i64 %res, ptr %retptr, align 8
ret void
}
Transformation seems to be correct! (syntactically equal)
-- 1. PassManager<Function> : Skipping NOP
-- 2. CodeGenPreparePass
----------------------------------------
define void @Test_no_bypassing(i32 %a, i64 %b, ptr %retptr) {
#0:
%a.1 = zext i32 %a to i64
%a.2 = sub i64 -1, %a.1
%res = srem i64 %a.2, %b
store i64 %res, ptr %retptr, align 8
ret void
}
Transformation seems to be correct! (syntactically equal)
-- 3. CodeGenPreparePass
----------------------------------------
define void @Test_no_bypassing(i32 %a, i64 %b, ptr %retptr) {
#0:
%a.1 = zext i32 %a to i64
%a.2 = sub i64 -1, %a.1
%res = srem i64 %a.2, %b
store i64 %res, ptr %retptr, align 8
ret void
}
Transformation seems to be correct! (syntactically equal)
-- 4. PassManager<Function> : Skipping NOP
-- 5. PassManager<Function> : Skipping NOP
-- 6. CodeGenPreparePass
----------------------------------------
define void @Test_check_one_operand(i64 %a, i32 %b, ptr %retptr) {
#0:
%b.1 = zext i32 %b to i64
%res = sdiv i64 %a, %b.1
store i64 %res, ptr %retptr, align 8
ret void
}
Transformation seems to be correct! (syntactically equal)
-- 7. CodeGenPreparePass
----------------------------------------
define void @Test_check_one_operand(i64 %a, i32 %b, ptr %retptr) {
#0:
%b.1 = zext i32 %b to i64
%res = sdiv i64 %a, %b.1
store i64 %res, ptr %retptr, align 8
ret void
}
=>
define void @Test_check_one_operand(i64 %a, i32 %b, ptr %retptr) {
#0:
%b.1 = zext i32 %b to i64
%#4 = and i64 %a, -4294967296
%#5 = icmp eq i64 %#4, 0
br i1 %#5, label %#2, label %#1
#1:
%#6 = sdiv i64 %a, %b.1
br label %#3
#2:
%#7 = trunc i64 %b.1 to i32
%#8 = trunc i64 %a to i32
%#9 = udiv i32 %#8, %#7
%#10 = zext i32 %#9 to i64
br label %#3
#3:
%#11 = phi i64 [ %#10, %#2 ], [ %#6, %#1 ]
store i64 %#11, ptr %retptr, align 8
ret void
}
Transformation doesn't verify! (unsound)
ERROR: Source is more defined than target
Example:
i64 %a = poison
i32 %b = #x00000001 (1)
ptr %retptr = pointer(non-local, block_id=1, offset=0) / Address=#x08
Source:
i64 %b.1 = #x0000000000000001 (1)
i64 %res = poison
SOURCE MEMORY STATE
===================
NON-LOCAL BLOCKS:
Block 0 > size: 0 align: 8 alloc type: 0 alive: false address: 0
Block 1 > size: 8 align: 1 alloc type: 0 alive: true address: 8
Target:
i64 %b.1 = #x0000000000000001 (1)
i64 %#4 = poison
i1 %#5 = poison
UB triggered on br
Pass: CodeGenPreparePass
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=require<profile-summary>,function(codegenprepare)' '-tv-smt-to=20000' '-tv-report-dir=/home/nlopes/alive2/build/logs' '-tv-smt-stats'
Wrote bitcode to: "/home/nlopes/alive2/build/logs/in_E7zxiSzL_n6O6.bc"
------------------- SMT STATS -------------------
Num queries: 29
Num invalid: 0
Num skips: 0
Num trivial: 4 (12.1%)
Num timeout: 0 (0.0%)
Num errors: 0 (0.0%)
Num SAT: 22 (75.9%)
Num UNSAT: 7 (24.1%)
Alive2: Transform doesn't verify; aborting!
RUN: at line 2: /home/nlopes/alive2/build/opt-alive.sh -S -passes='require<profile-summary>,function(codegenprepare)' < /bitbucket/nlopes/llvm/llvm/test/Transforms/CodeGenPrepare/NVPTX/bypass-slow-div-special-cases.ll | /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/CodeGenPrepare/NVPTX/bypass-slow-div-special-cases.ll + /home/nlopes/alive2/build/opt-alive.sh -S '-passes=require<profile-summary>,function(codegenprepare)' + /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/CodeGenPrepare/NVPTX/bypass-slow-div-special-cases.ll FileCheck error: '<stdin>' is empty. FileCheck command line: /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/CodeGenPrepare/NVPTX/bypass-slow-div-special-cases.ll