[llvm-bugs] [Bug 35038] New: GVN drops nonnull metadata
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Oct 23 09:39:19 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=35038
Bug ID: 35038
Summary: GVN drops nonnull metadata
Product: libraries
Version: 5.0
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: yyc1992 at gmail.com
CC: llvm-bugs at lists.llvm.org
Very similar to https://bugs.llvm.org/show_bug.cgi?id=30597 and
https://bugs.llvm.org/show_bug.cgi?id=31142 but for GVN this time.
Code to reproduce:
```
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
define i8* @f(i8** %v0, i8** %v1) {
top:
%v2 = load i8*, i8** %v0, !nonnull !0
store i8* %v2, i8** %v1
%v3 = load i8*, i8** %v1
ret i8* %v3
}
!0 = !{}
```
Running GVN produces
```
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
define i8* @f(i8** %v0, i8** %v1) {
top:
%v2 = load i8*, i8** %v0
store i8* %v2, i8** %v1
ret i8* %v2
}
```
while running instcombine produces
```
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
define i8* @f(i8** %v0, i8** %v1) {
top:
%0 = bitcast i8** %v0 to i64*
%v21 = load i64, i64* %0, align 8, !range !0
%1 = bitcast i8** %v1 to i64*
store i64 %v21, i64* %1, align 8
%v3.cast = inttoptr i64 %v21 to i8*
ret i8* %v3.cast
}
!0 = !{i64 1, i64 0}
```
The GVN version has deleted the `!nonnull` metadata on the load.
--
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/20171023/d2d3f1d0/attachment.html>
More information about the llvm-bugs
mailing list