Test Failure: Transforms/LoopIdiom/struct_pattern.ll

Test source: git

Log:

Source: <stdin>
-- 1. ModuleToFunctionPassAdaptor
-- 1. PassManager<Function> : Skipping NOP
-- 2. FunctionToLoopPassAdaptor

----------------------------------------
define void @bar1(ptr %f, i32 %n) {
entry:
  %cmp1 = icmp eq i32 %n, 0
  br i1 %cmp1, label %for.end, label %for.body.preheader

for.body.preheader:
  br label %for.body

for.body:
  %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
  %a = gep inbounds ptr %f, 8 x i64 %indvars.iv, 1 x i64 0
  store i32 2, ptr %a, align 4
  %b = gep inbounds ptr %f, 8 x i64 %indvars.iv, 1 x i64 4
  store i32 2, ptr %b, align 4
  %indvars.iv.next = add nsw nuw i64 %indvars.iv, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next to i32
  %exitcond = icmp ne i32 %lftr.wideiv, %n
  br i1 %exitcond, label %for.body, label %for.end.loopexit

for.end.loopexit:
  br label %for.end

for.end:
  ret void
}
Transformation seems to be correct! (syntactically equal)

-- 3. PassManager<Function> : Skipping NOP
-- 4. LoopSimplifyPass

----------------------------------------
define void @bar1(ptr %f, i32 %n) {
entry:
  %cmp1 = icmp eq i32 %n, 0
  br i1 %cmp1, label %for.end, label %for.body.preheader

for.body.preheader:
  br label %for.body

for.body:
  %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
  %a = gep inbounds ptr %f, 8 x i64 %indvars.iv, 1 x i64 0
  store i32 2, ptr %a, align 4
  %b = gep inbounds ptr %f, 8 x i64 %indvars.iv, 1 x i64 4
  store i32 2, ptr %b, align 4
  %indvars.iv.next = add nsw nuw i64 %indvars.iv, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next to i32
  %exitcond = icmp ne i32 %lftr.wideiv, %n
  br i1 %exitcond, label %for.body, label %for.end.loopexit

for.end.loopexit:
  br label %for.end

for.end:
  ret void
}
Transformation seems to be correct! (syntactically equal)

-- 5. LoopSimplifyPass

----------------------------------------
define void @bar1(ptr %f, i32 %n) {
entry:
  %cmp1 = icmp eq i32 %n, 0
  br i1 %cmp1, label %for.end, label %for.body.preheader

for.body.preheader:
  br label %for.body

for.body:
  %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
  %a = gep inbounds ptr %f, 8 x i64 %indvars.iv, 1 x i64 0
  store i32 2, ptr %a, align 4
  %b = gep inbounds ptr %f, 8 x i64 %indvars.iv, 1 x i64 4
  store i32 2, ptr %b, align 4
  %indvars.iv.next = add nsw nuw i64 %indvars.iv, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next to i32
  %exitcond = icmp ne i32 %lftr.wideiv, %n
  br i1 %exitcond, label %for.body, label %for.end.loopexit

for.end.loopexit:
  br label %for.end

for.end:
  ret void
}
Transformation seems to be correct! (syntactically equal)

-- 6. LCSSAPass

----------------------------------------
define void @bar1(ptr %f, i32 %n) {
entry:
  %cmp1 = icmp eq i32 %n, 0
  br i1 %cmp1, label %for.end, label %for.body.preheader

for.body.preheader:
  br label %for.body

for.body:
  %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
  %a = gep inbounds ptr %f, 8 x i64 %indvars.iv, 1 x i64 0
  store i32 2, ptr %a, align 4
  %b = gep inbounds ptr %f, 8 x i64 %indvars.iv, 1 x i64 4
  store i32 2, ptr %b, align 4
  %indvars.iv.next = add nsw nuw i64 %indvars.iv, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next to i32
  %exitcond = icmp ne i32 %lftr.wideiv, %n
  br i1 %exitcond, label %for.body, label %for.end.loopexit

for.end.loopexit:
  br label %for.end

for.end:
  ret void
}
Transformation seems to be correct! (syntactically equal)

-- 7. LCSSAPass

----------------------------------------
define void @bar1(ptr %f, i32 %n) {
entry:
  %cmp1 = icmp eq i32 %n, 0
  br i1 %cmp1, label %for.end, label %for.body.preheader

for.body.preheader:
  br label %for.body

for.body:
  %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
  %a = gep inbounds ptr %f, 8 x i64 %indvars.iv, 1 x i64 0
  store i32 2, ptr %a, align 4
  %b = gep inbounds ptr %f, 8 x i64 %indvars.iv, 1 x i64 4
  store i32 2, ptr %b, align 4
  %indvars.iv.next = add nsw nuw i64 %indvars.iv, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next to i32
  %exitcond = icmp ne i32 %lftr.wideiv, %n
  br i1 %exitcond, label %for.body, label %for.end.loopexit

for.end.loopexit:
  br label %for.end

for.end:
  ret void
}
Transformation seems to be correct! (syntactically equal)

-- 8. PassManager<Function> : Skipping NOP
-- 9. PassManager<Loop, AnalysisManager<Loop, LoopStandardAnalysisResults&>, LoopStandardAnalysisResults&, LPMUpdater&> : Skipping NOP
-- 10. LoopIdiomRecognizePass

----------------------------------------
define void @bar1(ptr %f, i32 %n) {
entry:
  %cmp1 = icmp eq i32 %n, 0
  br i1 %cmp1, label %for.end, label %for.body.preheader

for.body.preheader:
  br label %for.body

for.body:
  %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
  %a = gep inbounds ptr %f, 8 x i64 %indvars.iv, 1 x i64 0
  store i32 2, ptr %a, align 4
  %b = gep inbounds ptr %f, 8 x i64 %indvars.iv, 1 x i64 4
  store i32 2, ptr %b, align 4
  %indvars.iv.next = add nsw nuw i64 %indvars.iv, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next to i32
  %exitcond = icmp ne i32 %lftr.wideiv, %n
  br i1 %exitcond, label %for.body, label %for.end.loopexit

for.end.loopexit:
  br label %for.end

for.end:
  ret void
}
Transformation seems to be correct! (syntactically equal)

-- 11. LoopIdiomRecognizePass

----------------------------------------
define void @bar1(ptr %f, i32 %n) {
entry:
  %cmp1 = icmp eq i32 %n, 0
  br i1 %cmp1, label %for.end, label %for.body.preheader

for.body.preheader:
  br label %for.body

for.body:
  %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
  %a = gep inbounds ptr %f, 8 x i64 %indvars.iv, 1 x i64 0
  store i32 2, ptr %a, align 4
  %b = gep inbounds ptr %f, 8 x i64 %indvars.iv, 1 x i64 4
  store i32 2, ptr %b, align 4
  %indvars.iv.next = add nsw nuw i64 %indvars.iv, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next to i32
  %exitcond = icmp ne i32 %lftr.wideiv, %n
  br i1 %exitcond, label %for.body, label %for.end.loopexit

for.end.loopexit:
  br label %for.end

for.end:
  ret void
}
=>
declare void @memset_pattern16(nocapture noread ptr, nocapture nowrite ptr, i64) nofree willreturn memory(argmem: readwrite)

@.memset_pattern = constant 16 bytes, align 16

define void @bar1(ptr %f, i32 %n) {
init:
  store [4 x i32] { 2, 2, 2, 2 }, ptr @.memset_pattern, align 16
  br label %entry

entry:
  %cmp1 = icmp eq i32 %n, 0
  br i1 %cmp1, label %for.end, label %for.body.preheader

for.body.preheader:
  %#0 = zext i32 %n to i64
  %#1 = shl nsw nuw i64 %#0, 3
  memset_pattern16 ptr %f, ptr @.memset_pattern, i64 %#1
  br label %for.body

for.body:
  %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
  %indvars.iv.next = add nsw nuw i64 %indvars.iv, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next to i32
  %exitcond = icmp ne i32 %lftr.wideiv, %n
  br i1 %exitcond, label %for.body, label %for.end.loopexit

for.end.loopexit:
  br label %for.end

for.end:
  ret void
}
Transformation doesn't verify! (unsound)
ERROR: Mismatch in memory

Example:
ptr %f = pointer(non-local, block_id=1, offset=3)
i32 %n = #x00000001 (1)

Source:
i1 %cmp1 = #x0 (0)
  >> Jump to %for.body.preheader
  >> Jump to %for.body
i64 %indvars.iv = #x0000000000000000 (0)
ptr %a = pointer(non-local, block_id=1, offset=3)
ptr %b = pointer(non-local, block_id=1, offset=7)
i64 %indvars.iv.next = #x0000000000000001 (1)
i32 %lftr.wideiv = #x00000001 (1)
i1 %exitcond = #x0 (0)
  >> Jump to %for.end.loopexit
  >> Jump to %for.end

SOURCE MEMORY STATE
===================
NON-LOCAL BLOCKS:
Block 0 >	size: 0	align: 1	alloc type: 0	alive: false	address: 0
Block 1 >	size: 11	align: 1	alloc type: 0	alive: true	address: 1
Block 2 >	size: 16	align: 1	alloc type: 0	alive: true	address: 64	const

Target:
UB triggered on br

Mismatch in pointer(non-local, block_id=1, offset=3)
Source value: #x02
Target value: #x00

Pass: LoopIdiomRecognizePass
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=loop-idiom' '-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_tdRkgXAr_ZYPu.bc"


------------------- SMT STATS -------------------
Num queries: 31
Num invalid: 0
Num skips:   0
Num trivial: 13 (29.5%)
Num timeout: 1 (3.2%)
Num errors:  0 (0.0%)
Num SAT:     16 (51.6%)
Num UNSAT:   14 (45.2%)
Alive2: Transform doesn't verify; aborting!

stderr:

RUN: at line 2: /home/nlopes/alive2/build/opt-alive.sh -passes=loop-idiom < /bitbucket/nlopes/llvm/llvm/test/Transforms/LoopIdiom/struct_pattern.ll -S | /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/LoopIdiom/struct_pattern.ll
+ /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/LoopIdiom/struct_pattern.ll
+ /home/nlopes/alive2/build/opt-alive.sh -passes=loop-idiom -S

FileCheck error: '<stdin>' is empty.
FileCheck command line:  /bitbucket/nlopes/llvm/build/bin/FileCheck /bitbucket/nlopes/llvm/llvm/test/Transforms/LoopIdiom/struct_pattern.ll

 

<-- Back