[llvm-branch-commits] [clang] e8e0c07 - Merging r371557:

2019-12-11 Thread Tom Stellard via llvm-branch-commits

Author: Richard Smith
Date: 2019-12-11T10:40:38-08:00
New Revision: e8e0c077c416a15ccdec53c1252b787f6649ae70

URL: 
https://github.com/llvm/llvm-project/commit/e8e0c077c416a15ccdec53c1252b787f6649ae70
DIFF: 
https://github.com/llvm/llvm-project/commit/e8e0c077c416a15ccdec53c1252b787f6649ae70.diff

LOG: Merging r371557:


r371557 | rsmith | 2019-09-10 14:24:09 -0700 (Tue, 10 Sep 2019) | 7 lines

When evaluating a __builtin_constant_p conditional, always enter
constant-folding mode regardless of the original evaluation mode.

In order for this to be correct, we need to track whether we're checking
for a potential constant expression or checking for undefined behavior
separately from the evaluation mode enum, since we don't want to clobber
those states when entering constant-folding mode.


Added: 


Modified: 
clang/lib/AST/ExprConstant.cpp
clang/test/Sema/i-c-e.c

Removed: 




diff  --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index f01b42e7ff76..26163c6143e6 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -794,58 +794,47 @@ namespace {
 /// constant value.
 bool InConstantContext;
 
+/// Whether we're checking that an expression is a potential constant
+/// expression. If so, do not fail on constructs that could become constant
+/// later on (such as a use of an undefined global).
+bool CheckingPotentialConstantExpression = false;
+
+/// Whether we're checking for an expression that has undefined behavior.
+/// If so, we will produce warnings if we encounter an operation that is
+/// always undefined.
+bool CheckingForUndefinedBehavior = false;
+
 enum EvaluationMode {
   /// Evaluate as a constant expression. Stop if we find that the 
expression
   /// is not a constant expression.
   EM_ConstantExpression,
 
-  /// Evaluate as a potential constant expression. Keep going if we hit a
-  /// construct that we can't evaluate yet (because we don't yet know the
-  /// value of something) but stop if we hit something that could never be
-  /// a constant expression.
-  EM_PotentialConstantExpression,
+  /// Evaluate as a constant expression. Stop if we find that the 
expression
+  /// is not a constant expression. Some expressions can be retried in the
+  /// optimizer if we don't constant fold them here, but in an unevaluated
+  /// context we try to fold them immediately since the optimizer never
+  /// gets a chance to look at it.
+  EM_ConstantExpressionUnevaluated,
 
   /// Fold the expression to a constant. Stop if we hit a side-effect that
   /// we can't model.
   EM_ConstantFold,
 
-  /// Evaluate the expression looking for integer overflow and similar
-  /// issues. Don't worry about side-effects, and try to visit all
-  /// subexpressions.
-  EM_EvaluateForOverflow,
-
   /// Evaluate in any way we know how. Don't worry about side-effects that
   /// can't be modeled.
   EM_IgnoreSideEffects,
-
-  /// Evaluate as a constant expression. Stop if we find that the 
expression
-  /// is not a constant expression. Some expressions can be retried in the
-  /// optimizer if we don't constant fold them here, but in an unevaluated
-  /// context we try to fold them immediately since the optimizer never
-  /// gets a chance to look at it.
-  EM_ConstantExpressionUnevaluated,
-
-  /// Evaluate as a potential constant expression. Keep going if we hit a
-  /// construct that we can't evaluate yet (because we don't yet know the
-  /// value of something) but stop if we hit something that could never be
-  /// a constant expression. Some expressions can be retried in the
-  /// optimizer if we don't constant fold them here, but in an unevaluated
-  /// context we try to fold them immediately since the optimizer never
-  /// gets a chance to look at it.
-  EM_PotentialConstantExpressionUnevaluated,
 } EvalMode;
 
 /// Are we checking whether the expression is a potential constant
 /// expression?
 bool checkingPotentialConstantExpression() const {
-  return EvalMode == EM_PotentialConstantExpression ||
- EvalMode == EM_PotentialConstantExpressionUnevaluated;
+  return CheckingPotentialConstantExpression;
 }
 
 /// Are we checking an expression for overflow?
 // FIXME: We should check for any kind of undefined or suspicious behavior
 // in such constructs, not just overflow.
-bool checkingForOverflow() { return EvalMode == EM_EvaluateForOverflow; }
+bool checkingForUndefinedBehavior() { return CheckingForUndefinedBehavior; 
}
 
 EvalInfo(const ASTContext &C, Expr::

[llvm-branch-commits] [llvm] f2c8771 - Merging r372480:

2019-12-11 Thread Tom Stellard via llvm-branch-commits

Author: Suyog Sarda
Date: 2019-12-11T10:59:13-08:00
New Revision: f2c8771612905e590453b2f5f3e851d184cf7509

URL: 
https://github.com/llvm/llvm-project/commit/f2c8771612905e590453b2f5f3e851d184cf7509
DIFF: 
https://github.com/llvm/llvm-project/commit/f2c8771612905e590453b2f5f3e851d184cf7509.diff

LOG: Merging r372480:


r372480 | ssarda | 2019-09-21 11:16:37 -0700 (Sat, 21 Sep 2019) | 9 lines

SROA: Check Total Bits of vector type

While Promoting alloca instruction of Vector Type,
Check total size in bits of its slices too.
If they don't match, don't promote the alloca instruction.

Bug : https://bugs.llvm.org/show_bug.cgi?id=42585



Added: 
llvm/test/Transforms/SROA/vector-promotion-different-size.ll

Modified: 
llvm/lib/Transforms/Scalar/SROA.cpp

Removed: 




diff  --git a/llvm/lib/Transforms/Scalar/SROA.cpp 
b/llvm/lib/Transforms/Scalar/SROA.cpp
index 33f90d0b01e4..bd4c21d65abc 100644
--- a/llvm/lib/Transforms/Scalar/SROA.cpp
+++ b/llvm/lib/Transforms/Scalar/SROA.cpp
@@ -1888,6 +1888,14 @@ static VectorType *isVectorPromotionViable(Partition &P, 
const DataLayout &DL) {
   bool HaveCommonEltTy = true;
   auto CheckCandidateType = [&](Type *Ty) {
 if (auto *VTy = dyn_cast(Ty)) {
+  // Return if bitcast to vectors is 
diff erent for total size in bits.
+  if (!CandidateTys.empty()) {
+VectorType *V = CandidateTys[0];
+if (DL.getTypeSizeInBits(VTy) != DL.getTypeSizeInBits(V)) {
+  CandidateTys.clear();
+  return;
+}
+  }
   CandidateTys.push_back(VTy);
   if (!CommonEltTy)
 CommonEltTy = VTy->getElementType();

diff  --git a/llvm/test/Transforms/SROA/vector-promotion-
diff erent-size.ll b/llvm/test/Transforms/SROA/vector-promotion-
diff erent-size.ll
new file mode 100644
index ..56e1f1f2160a
--- /dev/null
+++ b/llvm/test/Transforms/SROA/vector-promotion-
diff erent-size.ll
@@ -0,0 +1,24 @@
+; RUN: opt < %s -sroa -S | FileCheck %s
+target datalayout = 
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-n8:16:32:64"
+
+define <4 x i1> @vector_bitcast() {
+  ; CHECK-LABEL: @vector_bitcast
+  ; CHECK: alloca i1
+
+%a = alloca <3 x i1>
+store <3 x i1> , <3 x i1>* %a
+%cast = bitcast <3 x i1>* %a to <4 x i1>*
+%vec = load <4 x i1>, <4 x i1>* %cast
+ret <4 x i1> %vec
+}
+
+define void @vector_bitcast_2() {
+  ; CHECK-LABEL: @vector_bitcast_2
+  ; CHECK: alloca <32 x i16>
+
+%"sum$1.host2" = alloca <32 x i16>
+store <32 x i16> undef, <32 x i16>* %"sum$1.host2"
+%bc = bitcast <32 x i16>* %"sum$1.host2" to <64 x i16>*
+%bcl = load <64 x i16>, <64 x i16>* %bc
+ret void
+}



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] c1a0a21 - export.sh: Fetch sources from GitHub instead of SVN

2019-12-11 Thread Tom Stellard via llvm-branch-commits

Author: Tom Stellard
Date: 2019-12-11T11:15:30-08:00
New Revision: c1a0a213378a458fbea1a5c77b315c7dce08fd05

URL: 
https://github.com/llvm/llvm-project/commit/c1a0a213378a458fbea1a5c77b315c7dce08fd05
DIFF: 
https://github.com/llvm/llvm-project/commit/c1a0a213378a458fbea1a5c77b315c7dce08fd05.diff

LOG: export.sh: Fetch sources from GitHub instead of SVN

Reviewers: hansw, jdoerfert

Subscribers: sylvestre.ledru, mgorny, hans, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D70460

(cherry picked from commit edf6717d8d30034da932b95350898e03c90a5082)

Added: 


Modified: 
llvm/utils/release/export.sh

Removed: 




diff  --git a/llvm/utils/release/export.sh b/llvm/utils/release/export.sh
index 9cd64a3d255f..02a77afd0533 100755
--- a/llvm/utils/release/export.sh
+++ b/llvm/utils/release/export.sh
@@ -13,14 +13,13 @@
 
 set -e
 
-projects="llvm cfe test-suite compiler-rt libcxx libcxxabi clang-tools-extra 
polly lldb lld openmp libunwind"
-base_url="https://llvm.org/svn/llvm-project";
+projects="llvm clang test-suite compiler-rt libcxx libcxxabi clang-tools-extra 
polly lldb lld openmp libunwind"
 
 release=""
 rc=""
 
 usage() {
-echo "Export the SVN sources and build tarballs from them"
+echo "Export the Git sources and build tarballs from them"
 echo "usage: `basename $0`"
 echo " "
 echo "  -release  The version number of the release"
@@ -30,20 +29,34 @@ usage() {
 
 export_sources() {
 release_no_dot=`echo $release | sed -e 's,\.,,g'`
-tag_dir="tags/RELEASE_$release_no_dot/$rc"
+tag="llvmorg-$release"
 
 if [ "$rc" = "final" ]; then
 rc=""
+else
+tag="$tag-$rc"
 fi
 
-for proj in $projects; do
-echo "Exporting $proj ..."
-svn export \
-$base_url/$proj/$tag_dir \
-$proj-$release$rc.src
+llvm_src_dir=llvm-project-$release$rc
+mkdir -p $llvm_src_dir
+
+echo $tag
+echo "Fetching LLVM project source ..."
+curl -L https://github.com/llvm/llvm-project/archive/$tag.tar.gz | \
+tar -C $llvm_src_dir --strip-components=1 -xzf -
+
+echo "Creating tarball for llvm-project ..."
+tar -cJf llvm-project-$release$rc.tar.xz $llvm_src_dir
 
-echo "Creating tarball ..."
-tar cfJ $proj-$release$rc.src.tar.xz $proj-$release$rc.src
+echo "Fetching LLVM test-suite source ..."
+mkdir -p $llvm_src_dir/test-suite
+curl -L https://github.com/llvm/test-suite/archive/$tag.tar.gz | \
+tar -C $llvm_src_dir/test-suite --strip-components=1 -xzf -
+
+for proj in $projects; do
+echo "Creating tarball for $proj ..."
+mv $llvm_src_dir/$proj $llvm_src_dir/$proj-$release$rc.src
+tar -C $llvm_src_dir -cJf $proj-$release$rc.src.tar.xz 
$proj-$release$rc.src
 done
 }
 



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits