[llvm-bugs] [Bug 45526] New: LoopVectorization miscompile
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Apr 14 02:15:57 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=45526
Bug ID: 45526
Summary: LoopVectorization miscompile
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Loop Optimizer
Assignee: unassignedbugs at nondot.org
Reporter: serguei.katkov at azul.com
CC: llvm-bugs at lists.llvm.org
The inner loop of the following IR is incorrectly vectorized by 32 while has
only couple of iteration. It finally results in miscompile:
=====================================================================
; ModuleID = './repro.ll'
source_filename = "./repro.ll"
target datalayout =
"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128-ni:1-p2:32:8:8:32-ni:2"
target triple = "x86_64-unknown-linux-gnu"
@global = external global i8*
define void @hoge(i8* nonnull align 8 dereferenceable_or_null(8) %arg, i8*
align 8 dereferenceable_or_null(16) %arg1) {
bb:
%tmp = load atomic i8*, i8** @global unordered, align 8
%tmp2 = getelementptr inbounds i8, i8* %tmp, i64 852
br label %bb3
bb3: ; preds = %bb12, %bb
%tmp4 = phi i32 [ 1, %bb ], [ %tmp15, %bb12 ]
%tmp5 = phi i32 [ 0, %bb ], [ %tmp8, %bb12 ]
br label %bb7
bb6: ; preds = %bb12
ret void
bb7: ; preds = %bb7, %bb3
%tmp8 = phi i32 [ %tmp5, %bb3 ], [ %tmp10, %bb7 ]
%tmp9 = phi i32 [ 1, %bb3 ], [ %tmp10, %bb7 ]
%tmp10 = add nuw nsw i32 %tmp9, 1
%tmp11 = icmp ugt i32 %tmp9, 5
br i1 %tmp11, label %bb12, label %bb7
bb12: ; preds = %bb7
%tmp13 = mul i32 %tmp8, %tmp4
%tmp14 = trunc i32 %tmp13 to i8
fence release
store atomic i8 %tmp14, i8* %tmp2 unordered, align 1
fence seq_cst
%tmp15 = add nuw nsw i32 %tmp4, 1
%tmp16 = icmp ult i32 %tmp4, 240
br i1 %tmp16, label %bb3, label %bb6
}
=====================================================================
To reproduce:
> opt -passes=loop-vectorize -S -o res.ll ./repro.ll
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200414/0c668680/attachment.html>
More information about the llvm-bugs
mailing list