Test source: git
Comments: LLVM bug: introduces load type punning
Source: <stdin> -- 1. ModuleToFunctionPassAdaptor -- 1. PassManager<Function> : Skipping NOP -- 2. GVNPass ---------------------------------------- define i64 @foo(ptr %arrayidx) { entry: %p = load ptr, ptr %arrayidx, align 8 %cmpnull = icmp eq ptr %p, null br label %BB2 entry2: br label %BB2 BB2: %load = load i64, ptr %arrayidx, align 8 ret i64 %load } Transformation seems to be correct! (syntactically equal) -- 3. GVNPass ---------------------------------------- define i64 @foo(ptr %arrayidx) { entry: %p = load ptr, ptr %arrayidx, align 8 br label %BB2 BB2: %load = load i64, ptr %arrayidx, align 8 ret i64 %load } => define i64 @foo(ptr %arrayidx) { entry: %p = load ptr, ptr %arrayidx, align 8 %#0 = ptrtoint ptr %p to i64 br label %BB2 BB2: ret i64 %#0 } Transformation doesn't verify! (unsound) ERROR: Target is more poisonous than source Example: ptr %arrayidx = pointer(non-local, block_id=1, offset=0) / Address=#x0000000000000008 Source: ptr %p = poison >> Jump to %BB2 i64 %load = #x0800000000000000 (576460752303423488) SOURCE MEMORY STATE =================== NON-LOCAL BLOCKS: Block 0 > size: 0 align: 8 alloc type: 0 alive: false address: 0 Block 1 > size: 8 align: 8 alloc type: 0 alive: true address: 8 Contents: *: #x0800000000000000 Block 2 > size: 7 align: 1 alloc type: 0 alive: true address: 1 Contents: *: #x0800000000000000 Target: ptr %p = poison i64 %#0 = poison >> Jump to %BB2 Source value: #x0800000000000000 (576460752303423488) Target value: poison Pass: GVNPass 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=gvn' '-disable-output' '-tv-smt-to=20000' '-tv-report-dir=/home/nlopes/alive2/build/logs' '-tv-smt-stats' Wrote bitcode to: "/home/nlopes/alive2/build/logs/in_CwtfiOs7_7iN5.bc" ------------------- SMT STATS ------------------- Num queries: 29 Num invalid: 0 Num skips: 0 Num trivial: 5 (14.7%) Num timeout: 0 (0.0%) Num errors: 0 (0.0%) Num SAT: 19 (65.5%) Num UNSAT: 10 (34.5%) Alive2: Transform doesn't verify; aborting!
RUN: at line 1: /home/nlopes/alive2/build/opt-alive.sh -passes=gvn -disable-output < /bitbucket/nlopes/llvm/llvm/test/Transforms/GVN/pr24397.ll + /home/nlopes/alive2/build/opt-alive.sh -passes=gvn -disable-output