[polly] r265884 - [FIX] Do not allow select as a base pointer in the SCoP region

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 9 14:57:13 PDT 2016


Author: jdoerfert
Date: Sat Apr  9 16:57:13 2016
New Revision: 265884

URL: http://llvm.org/viewvc/llvm-project?rev=265884&view=rev
Log:
[FIX] Do not allow select as a base pointer in the SCoP region


Added:
    polly/trunk/test/Isl/CodeGen/select-base-pointer.ll
Modified:
    polly/trunk/lib/Analysis/ScopDetection.cpp

Modified: polly/trunk/lib/Analysis/ScopDetection.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopDetection.cpp?rev=265884&r1=265883&r2=265884&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopDetection.cpp (original)
+++ polly/trunk/lib/Analysis/ScopDetection.cpp Sat Apr  9 16:57:13 2016
@@ -578,6 +578,9 @@ bool ScopDetection::isInvariant(const Va
   if (I->mayHaveSideEffects())
     return false;
 
+  if (isa<SelectInst>(I))
+    return false;
+
   // When Val is a Phi node, it is likely not invariant. We do not check whether
   // Phi nodes are actually invariant, we assume that Phi nodes are usually not
   // invariant.

Added: polly/trunk/test/Isl/CodeGen/select-base-pointer.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/CodeGen/select-base-pointer.ll?rev=265884&view=auto
==============================================================================
--- polly/trunk/test/Isl/CodeGen/select-base-pointer.ll (added)
+++ polly/trunk/test/Isl/CodeGen/select-base-pointer.ll Sat Apr  9 16:57:13 2016
@@ -0,0 +1,65 @@
+; RUN: opt %loadPolly -tbaa -polly-codegen -disable-output %s
+;
+; Check that we do not crash here.
+;
+; ModuleID = 'bugpoint-reduced-simplified.bc'
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+
+%"DOMParentNode" = type { %"DOMNode"*, %"DOMNode"*, %"DOMNodeListImpl" }
+%"DOMDocumentRange" = type { i32 (...)** }
+%"DOMXPathEvaluator" = type { i32 (...)** }
+%"DOMDocumentTraversal" = type { i32 (...)** }
+%"DOMNode" = type { i32 (...)** }
+%"DOMNodeListImpl" = type { %"DOMNodeList", %"DOMNode"* }
+%"DOMNodeList" = type { i32 (...)** }
+%"DOMElementImpl" = type { %"DOMElement", %"DOMNodeImpl", %"DOMParentNode", %"DOMChildNode", %"DOMAttrMapImpl"*, %"DOMAttrMapImpl"*, i16* }
+%"DOMElement" = type { %"DOMNode" }
+%"DOMNodeImpl" = type <{ %"DOMNode"*, i16, [6 x i8] }>
+%"DOMChildNode" = type { %"DOMNode"*, %"DOMNode"* }
+%"DOMAttrMapImpl" = type <{ %"DOMNamedNodeMapImpl", i8, [7 x i8] }>
+%"DOMNamedNodeMapImpl" = type { %"DOMNamedNodeMap", %"DOMNode"* }
+%"DOMNamedNodeMap" = type { i32 (...)** }
+%"DOMTextImpl" = type { %"DOMText", %"DOMNodeImpl", %"DOMChildNode" }
+%"DOMText" = type { %"DOMCharacterData" }
+%"DOMCharacterData" = type { %"DOMNode" }
+
+; Function Attrs: uwtable
+define void @_ZN11xercesc_2_513DOMParentNode9lastChildEPNS_7DOMNodeE(%"DOMParentNode"* %this, %"DOMNode"* %node) #0 align 2 {
+entry:
+  br label %entry.split
+
+entry.split:                                      ; preds = %entry
+  %fFirstChild = getelementptr inbounds %"DOMParentNode", %"DOMParentNode"* %this, i32 0, i32 1
+  %0 = load %"DOMNode"*, %"DOMNode"** %fFirstChild, align 8, !tbaa !1
+  %cmp = icmp ne %"DOMNode"* %0, null
+  br i1 %cmp, label %if.then, label %if.end
+
+if.then:                                          ; preds = %entry.split
+  %1 = bitcast %"DOMNode"* %0 to %"DOMElementImpl"*
+  %fNode.i = getelementptr inbounds %"DOMElementImpl", %"DOMElementImpl"* %1, i32 0, i32 1
+  %flags.i.i = getelementptr inbounds %"DOMNodeImpl", %"DOMNodeImpl"* %fNode.i, i32 0, i32 1
+  %2 = load i16, i16* %flags.i.i, align 8, !tbaa !7
+  %3 = bitcast %"DOMNode"* %0 to %"DOMTextImpl"*
+  %fChild.i = getelementptr inbounds %"DOMTextImpl", %"DOMTextImpl"* %3, i32 0, i32 2
+  %fChild1.i = getelementptr inbounds %"DOMElementImpl", %"DOMElementImpl"* %1, i32 0, i32 3
+  %retval.0.i = select i1 undef, %"DOMChildNode"* %fChild.i, %"DOMChildNode"* %fChild1.i
+  %previousSibling = getelementptr inbounds %"DOMChildNode", %"DOMChildNode"* %retval.0.i, i32 0, i32 0
+  store %"DOMNode"* %node, %"DOMNode"** %previousSibling, align 8, !tbaa !10
+  br label %if.end
+
+if.end:                                           ; preds = %if.then, %entry.split
+  ret void
+}
+
+!0 = !{!"clang version 3.9.0 (http://llvm.org/git/clang.git 8518d88c3151548eb6d8a7a0bb28c73f65acd897)"}
+!1 = !{!2, !3, i64 8}
+!2 = !{!"_ZTSN11xercesc_2_513DOMParentNodeE", !3, i64 0, !3, i64 8, !6, i64 16}
+!3 = !{!"any pointer", !4, i64 0}
+!4 = !{!"omnipotent char", !5, i64 0}
+!5 = !{!"Simple C++ TBAA"}
+!6 = !{!"_ZTSN11xercesc_2_515DOMNodeListImplE", !3, i64 8}
+!7 = !{!8, !9, i64 8}
+!8 = !{!"_ZTSN11xercesc_2_511DOMNodeImplE", !3, i64 0, !9, i64 8}
+!9 = !{!"short", !4, i64 0}
+!10 = !{!11, !3, i64 0}
+!11 = !{!"_ZTSN11xercesc_2_512DOMChildNodeE", !3, i64 0, !3, i64 8}




More information about the llvm-commits mailing list