[llvm-commits] [poolalloc] r164612 - in /poolalloc/trunk: lib/DSA/DataStructure.cpp test/dsa/regression/2012-09-25.RCForwarding.ll

Will Dietz wdietz2 at illinois.edu
Tue Sep 25 10:40:11 PDT 2012


Author: wdietz2
Date: Tue Sep 25 12:40:11 2012
New Revision: 164612

URL: http://llvm.org/viewvc/llvm-project?rev=164612&view=rev
Log:
ReachabilityCloner: Fix bug regarding arg evaluation and node forwarding.

Fix is to force evaluation order, and resolve forwarding explicitly
before passing any of the DSNode/DSNodeHandles to the DSCallsite constructor.

Only triggers when built with gcc, due to argument evaluation order difference.

Thanks to Joshua for the reduced testcase and reporting this!

Added:
    poolalloc/trunk/test/dsa/regression/2012-09-25.RCForwarding.ll
Modified:
    poolalloc/trunk/lib/DSA/DataStructure.cpp

Modified: poolalloc/trunk/lib/DSA/DataStructure.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DataStructure.cpp?rev=164612&r1=164611&r2=164612&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/DataStructure.cpp (original)
+++ poolalloc/trunk/lib/DSA/DataStructure.cpp Tue Sep 25 12:40:11 2012
@@ -1070,12 +1070,17 @@
                       getClonedNH(SrcCS.getVAVal()),
                       SrcCS.getCalleeFunc(),
                       Args);
-  else
-    return DSCallSite(SrcCS.getCallSite(),
-                      getClonedNH(SrcCS.getRetVal()),
-                      getClonedNH(SrcCS.getVAVal()),
-                      getClonedNH(SrcCS.getCalleeNode()).getNode(),
-                      Args);
+  else {
+    DSNodeHandle Ret = getClonedNH(SrcCS.getRetVal()),
+                 VA = getClonedNH(SrcCS.getVAVal()),
+                 Callee = getClonedNH(SrcCS.getCalleeNode());
+    // Resolve forwarding now as much as possible.
+    Ret.getNode(); VA.getNode();
+    // Most importantly, ensure the node passed to DSCallSite
+    // is not a forwarding node:
+    DSNode * CalleeN = Callee.getNode();
+    return DSCallSite(SrcCS.getCallSite(), Ret, VA, CalleeN, Args);
+  }
 }
 
 //===----------------------------------------------------------------------===//

Added: poolalloc/trunk/test/dsa/regression/2012-09-25.RCForwarding.ll
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/regression/2012-09-25.RCForwarding.ll?rev=164612&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/regression/2012-09-25.RCForwarding.ll (added)
+++ poolalloc/trunk/test/dsa/regression/2012-09-25.RCForwarding.ll Tue Sep 25 12:40:11 2012
@@ -0,0 +1,127 @@
+;RUN: dsaopt %s -dsa-eqtd -disable-output
+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.anon = type { i32, %struct._icmBase* (%struct._icc*)* }
+%struct._icmBase = type { i32, %struct._icc*, i32, i32, i32 (%struct._icmBase*)*, i32 (%struct._icmBase*, i64, i64)*, i32 (%struct._icmBase*, i64)*, void (%struct._icmBase*)*, void (%struct._icmBase*, %struct._IO_FILE*, i32)*, i32 (%struct._icmBase*)* }
+%struct._icc = type { i32 (%struct._icc*)*, i32 (%struct._icc*, %struct._icmFile*, i64)*, i32 (%struct._icc*, %struct._icmFile*, i64)*, void (%struct._icc*, %struct._IO_FILE*, i32)*, void (%struct._icc*)*, i32 (%struct._icc*, i32)*, %struct._icmBase* (%struct._icc*, i32)*, %struct._icmBase* (%struct._icc*, i32, i32)*, i32 (%struct._icc*, i32, i32)*, %struct._icmBase* (%struct._icc*, i32, i32)*, i32 (%struct._icc*, i32)*, i32 (%struct._icc*)*, i32 (%struct._icc*, i32)*, %struct._icmLuBase* (%struct._icc*, i32, i32, i32, i32)*, %struct._icmHeader*, [512 x i8], i32, %struct._icmAlloc*, i32, %struct._icmFile*, i64, i32, %struct.icmTag* }
+%struct._icmFile = type { i32 (%struct._icmFile*, i64)*, i64 (%struct._icmFile*, i8*, i64, i64)*, i64 (%struct._icmFile*, i8*, i64, i64)*, i32 (%struct._icmFile*)*, i32 (%struct._icmFile*)* }
+%struct._IO_FILE = type { i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct._IO_marker*, %struct._IO_FILE*, i32, i32, i64, i16, i8, [1 x i8], i8*, i64, i8*, i8*, i8*, i8*, i64, i32, [20 x i8] }
+%struct._IO_marker = type { %struct._IO_marker*, %struct._IO_FILE*, i32 }
+%struct._icmLuBase = type { i32, %struct._icc*, i32, i32, %struct.icmXYZNumber, %struct.icmXYZNumber, %struct.icmXYZNumber, [3 x [3 x double]], [3 x [3 x double]], i32, i32, i32, i32, i32, i32, void (%struct._icmLuBase*)*, void (%struct._icmLuBase*, i32*, i32*, i32*, i32*)*, void (%struct._icmLuBase*, i32*, i32*, i32*, i32*, i32*, i32*, i32*, i32*)*, void (%struct._icmLuBase*, double*, double*, double*, double*)*, void (%struct._icmLuBase*, %struct.icmXYZNumber*, %struct.icmXYZNumber*)*, i32 (%struct._icmLuBase*, double*, double*)* }
+%struct.icmXYZNumber = type { double, double, double }
+%struct._icmHeader = type { i32 (%struct._icmHeader*)*, i32 (%struct._icmHeader*, i64, i64)*, i32 (%struct._icmHeader*, i64)*, void (%struct._icmHeader*)*, %struct._icc*, i32, void (%struct._icmHeader*, %struct._IO_FILE*, i32)*, i32, i32, i32, i32, i32, i32, %struct.icmUint64, i32, i32, i32, i32, i32, i32, %struct._icmDateTimeNumber, i32, %struct.icmXYZNumber }
+%struct.icmUint64 = type { i64, i64 }
+%struct._icmDateTimeNumber = type { i32, %struct._icc*, i32, i32, i32 (%struct._icmBase*)*, i32 (%struct._icmBase*, i64, i64)*, i32 (%struct._icmBase*, i64)*, void (%struct._icmBase*)*, void (%struct._icmBase*, %struct._IO_FILE*, i32)*, i32 (%struct._icmBase*)*, i32, i32, i32, i32, i32, i32 }
+%struct._icmAlloc = type { i8* (%struct._icmAlloc*, i64)*, i8* (%struct._icmAlloc*, i64, i64)*, i8* (%struct._icmAlloc*, i8*, i64)*, void (%struct._icmAlloc*, i8*)*, void (%struct._icmAlloc*)* }
+%struct.icmTag = type { i32, i32, i32, i32, %struct._icmBase* }
+
+ at typetable = internal unnamed_addr constant [25 x %struct.anon] [%struct.anon { i32 1668441193, %struct._icmBase* (%struct._icc*)* @new_icmCrdInfo }, %struct.anon { i32 1668641398, %struct._icmBase* (%struct._icc*)* @new_icmCurve }, %struct.anon { i32 1684108385, %struct._icmBase* (%struct._icc*)* @new_icmData }, %struct.anon { i32 1685350765, %struct._icmBase* (%struct._icc*)* @new_icmDateTimeNumber }, %struct.anon { i32 1835430962, %struct._icmBase* (%struct._icc*)* @new_icmLut }, %struct.anon { i32 1835430961, %struct._icmBase* (%struct._icc*)* @new_icmLut }, %struct.anon { i32 1835360627, %struct._icmBase* (%struct._icc*)* @new_icmMeasurement }, %struct.anon { i32 1852010348, %struct._icmBase* (%struct._icc*)* @new_icmNamedColor }, %struct.anon { i32 1852009522, %struct._icmBase* (%struct._icc*)* @new_icmNamedColor }, %struct.anon { i32 1886610801, %struct._icmBase* (%struct._icc*)* @new_icmProfileSequenceDesc }, %struct.anon { i32 1936077618, %struct._icmBase* (%struct.
 _icc*)* @new_icmS15Fixed16Array }, %struct.anon { i32 1935897198, %struct._icmBase* (%struct._icc*)* @new_icmScreening }, %struct.anon { i32 1936287520, %struct._icmBase* (%struct._icc*)* @new_icmSignature }, %struct.anon { i32 1684370275, %struct._icmBase* (%struct._icc*)* @new_icmTextDescription }, %struct.anon { i32 1952807028, %struct._icmBase* (%struct._icc*)* @new_icmText }, %struct.anon { i32 1969632050, %struct._icmBase* (%struct._icc*)* @new_icmU16Fixed16Array }, %struct.anon { i32 1650877472, %struct._icmBase* (%struct._icc*)* @new_icmUcrBg }, %struct.anon { i32 1986226036, %struct._icmBase* (%struct._icc*)* @new_icmVideoCardGamma }, %struct.anon { i32 1969828150, %struct._icmBase* (%struct._icc*)* @new_icmUInt16Array }, %struct.anon { i32 1969828658, %struct._icmBase* (%struct._icc*)* @new_icmUInt32Array }, %struct.anon { i32 1969829428, %struct._icmBase* (%struct._icc*)* @new_icmUInt64Array }, %struct.anon { i32 1969827896, %struct._icmBase* (%struct._icc*)* @new
 _icmUInt8Array }, %struct.anon { i32 1986618743, %struct._icmBase* (%struct._icc*)* @new_icmViewingConditions }, %struct.anon { i32 1482250784, %struct._icmBase* (%struct._icc*)* @new_icmXYZArray }, %struct.anon { i32 -1, %struct._icmBase* (%struct._icc*)* null }], align 16
+ at llvm.compiler.used = appending global [0 x i8*] zeroinitializer, section "llvm.metadata"
+
+declare i32 @test() nounwind readnone
+
+define void @new_icc_a() noreturn nounwind uwtable {
+entry:
+  store %struct._icmBase* (%struct._icc*, i32, i32)* @icc_add_tag, %struct._icmBase* (%struct._icc*, i32, i32)** inttoptr (i64 56 to %struct._icmBase* (%struct._icc*, i32, i32)**), align 8, !tbaa !0
+  tail call void @llvm.trap()
+  unreachable
+}
+
+define void @icc_dump() noreturn nounwind uwtable readnone {
+entry:
+  unreachable
+}
+
+define noalias %struct._icmBase* @icc_add_tag(%struct._icc* nocapture %p, i32 %sig, i32 %ttype) noreturn nounwind uwtable {
+entry:
+  %0 = tail call i32 @test() nounwind readnone
+  %cmp = icmp eq i32 %0, 44
+  br i1 %cmp, label %for.body30, label %for.body
+for.body:                                         ; preds = %entry, %for.body
+  br label %for.body
+
+for.body30:                                       ; preds = %entry, %for.body30
+  %idxprom26144 = phi i64 [ 44, %for.body30 ], [ 0, %entry ]
+  %ttype28 = getelementptr inbounds [25 x %struct.anon]* @typetable, i64 0, i64 %idxprom26144, i32 0
+  %1 = load i32* %ttype28, align 16, !tbaa !1
+  %cmp34 = icmp eq i32 %1, %ttype
+  br i1 %cmp34, label %for.cond49.preheader, label %for.body30
+
+for.cond49.preheader:                             ; preds = %for.body30
+  tail call void @llvm.trap()
+  unreachable
+}
+
+define void @icc_link_tag() noreturn nounwind uwtable readnone {
+entry:
+  unreachable
+}
+declare %struct._icmBase* @new_icmCrdInfo(%struct._icc*) nounwind uwtable
+
+declare %struct._icmBase* @new_icmCurve(%struct._icc*) nounwind uwtable
+
+define noalias %struct._icmBase* @new_icmData(%struct._icc* %icp) nounwind uwtable {
+entry:
+  %al = getelementptr inbounds %struct._icc* %icp, i64 0, i32 17
+  %0 = load %struct._icmAlloc** %al, align 8, !tbaa !0
+  %calloc = getelementptr inbounds %struct._icmAlloc* %0, i64 0, i32 1
+  %1 = load i8* (%struct._icmAlloc*, i64, i64)** %calloc, align 8, !tbaa !0
+  %call = tail call i8* %1(%struct._icmAlloc* %0, i64 1, i64 96) nounwind
+  %get_size = getelementptr inbounds i8* %call, i64 24
+  %2 = bitcast i8* %get_size to i32 (%struct._icmBase*)**
+  store i32 (%struct._icmBase*)* @icmData_get_size, i32 (%struct._icmBase*)** %2, align 8, !tbaa !0
+  %icp2 = getelementptr inbounds i8* %call, i64 8
+  %3 = bitcast i8* %icp2 to %struct._icc**
+  store %struct._icc* %icp, %struct._icc** %3, align 8, !tbaa !0
+  ret %struct._icmBase* null
+}
+
+declare %struct._icmBase* @new_icmDateTimeNumber(%struct._icc*) nounwind uwtable
+declare %struct._icmBase* @new_icmLut(%struct._icc*) nounwind uwtable
+
+declare %struct._icmBase* @new_icmMeasurement(%struct._icc*) nounwind uwtable
+
+declare %struct._icmBase* @new_icmNamedColor(%struct._icc*) nounwind uwtable
+
+declare %struct._icmBase* @new_icmProfileSequenceDesc(%struct._icc*) nounwind uwtable
+
+declare %struct._icmBase* @new_icmS15Fixed16Array(%struct._icc*) nounwind uwtable
+
+declare %struct._icmBase* @new_icmScreening(%struct._icc*) nounwind uwtable
+
+declare %struct._icmBase* @new_icmSignature(%struct._icc*) nounwind uwtable
+
+declare %struct._icmBase* @new_icmTextDescription(%struct._icc*) nounwind uwtable
+
+declare %struct._icmBase* @new_icmText(%struct._icc*) nounwind uwtable
+declare %struct._icmBase* @new_icmU16Fixed16Array(%struct._icc*) nounwind uwtable
+
+declare %struct._icmBase* @new_icmUcrBg(%struct._icc*) nounwind uwtable
+
+declare %struct._icmBase* @new_icmVideoCardGamma(%struct._icc*) nounwind uwtable
+
+declare %struct._icmBase* @new_icmUInt16Array(%struct._icc*) nounwind uwtable
+
+declare %struct._icmBase* @new_icmUInt32Array(%struct._icc*) nounwind uwtable
+
+declare %struct._icmBase* @new_icmUInt64Array(%struct._icc*) nounwind uwtable
+
+declare %struct._icmBase* @new_icmUInt8Array(%struct._icc*) nounwind uwtable
+
+declare %struct._icmBase* @new_icmViewingConditions(%struct._icc*) nounwind uwtable
+
+declare %struct._icmBase* @new_icmXYZArray(%struct._icc*) nounwind uwtable
+
+define void @icmScreening_delete() noreturn nounwind uwtable readnone {
+entry:
+  unreachable
+}
+declare i32 @icmData_get_size(%struct._icmBase* nocapture) nounwind uwtable readonly
+
+declare void @llvm.trap() noreturn nounwind
+
+!0 = metadata !{metadata !"any pointer", metadata !1}
+!1 = metadata !{metadata !"omnipotent char", metadata !2}
+!2 = metadata !{metadata !"Simple C/C++ TBAA"}
+





More information about the llvm-commits mailing list