[LLVMbugs] [Bug 11471] New: alias analysis misled by pointer comparison
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri Dec 2 19:59:42 PST 2011
http://llvm.org/bugs/show_bug.cgi?id=11471
Bug #: 11471
Summary: alias analysis misled by pointer comparison
Product: libraries
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
AssignedTo: unassignedbugs at nondot.org
ReportedBy: richard-llvm at metafoo.co.uk
CC: llvmbugs at cs.uiuc.edu, nicholas at mxc.ca
Classification: Unclassified
Consider the following:
; ModuleID = '<stdin>'
target datalayout =
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
%struct.bar = type { i8, double, double, double }
define void @_Z1fP3bar(%struct.bar* noalias sret %agg.result, %struct.bar* %p)
nounwind uwtable {
entry:
%ok.i = getelementptr inbounds %struct.bar* %agg.result, i64 0, i32 0
store i8 1, i8* %ok.i, align 1, !tbaa !0
%cmp.i = icmp eq %struct.bar* %agg.result, %p
br i1 %cmp.i, label %if.then.i, label %_ZN3barC2EPS_.exit
if.then.i: ; preds = %entry
%ok2.i = getelementptr inbounds %struct.bar* %p, i64 0, i32 0
store i8 0, i8* %ok2.i, align 1, !tbaa !0
%0 = load i8* %ok.i, align 1, !tbaa !0
%1 = and i8 %0, 1
%tobool.i = icmp eq i8 %1, 0
br i1 %tobool.i, label %if.then4.i, label %_ZN3barC2EPS_.exit
if.then4.i: ; preds = %if.then.i
store i8 1, i8* %ok.i, align 1, !tbaa !0
br label %_ZN3barC2EPS_.exit
_ZN3barC2EPS_.exit: ; preds = %if.then4.i,
%if.then.i, %entry
ret void
}
!0 = metadata !{metadata !"bool", metadata !1}
!1 = metadata !{metadata !"omnipotent char", metadata !2}
!2 = metadata !{metadata !"Simple C/C++ TBAA", null}
We do not optimize this any further, apparently because the icmp of %agg.result
and %p is causing us to lose the knowledge that those two pointers don't alias.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list