]> granicus.if.org Git - llvm/commitdiff
[NewGVN] Add CL option to control the generation of phi-of-ops (disable by default).
authorChad Rosier <mcrosier@codeaurora.org>
Thu, 10 Aug 2017 14:12:57 +0000 (14:12 +0000)
committerChad Rosier <mcrosier@codeaurora.org>
Thu, 10 Aug 2017 14:12:57 +0000 (14:12 +0000)
Differential Revision: https://reviews.llvm.org/D36478539

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310594 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/NewGVN.cpp
test/Transforms/NewGVN/completeness.ll
test/Transforms/NewGVN/pr33461.ll
test/Transforms/NewGVN/storeoverstore.ll

index e620ae9c557f3ce53b6f8c0dc46101370d24174d..ceb53502f982cfa64d94794538541029ff5676ab 100644 (file)
@@ -127,6 +127,10 @@ DEBUG_COUNTER(PHIOfOpsCounter, "newgvn-phi",
 static cl::opt<bool> EnableStoreRefinement("enable-store-refinement",
                                            cl::init(false), cl::Hidden);
 
+/// Currently, the generation "phi of ops" can result in correctness issues.
+static cl::opt<bool> EnablePhiOfOps("enable-phi-of-ops", cl::init(false),
+                                    cl::Hidden);
+
 //===----------------------------------------------------------------------===//
 //                                GVN Pass
 //===----------------------------------------------------------------------===//
@@ -2442,6 +2446,8 @@ void NewGVN::addPhiOfOps(PHINode *Op, BasicBlock *BB,
 }
 
 static bool okayForPHIOfOps(const Instruction *I) {
+  if (!EnablePhiOfOps)
+    return false;
   return isa<BinaryOperator>(I) || isa<SelectInst>(I) || isa<CmpInst>(I) ||
          isa<LoadInst>(I);
 }
index 1798bfea5fe06a4a2150abad0a43d14bc7230b1c..0b5a13ec2ed2eba19d8a84847c88233f94edf5ff 100644 (file)
@@ -1,5 +1,5 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt < %s -basicaa -newgvn -S | FileCheck %s
+; RUN: opt < %s -basicaa -newgvn -enable-phi-of-ops=true -S | FileCheck %s
 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
 
 define i32 @test1(i32, i8**) {
index 0a41d6834a4a7a7a82eb3861fce83ddc1303dc92..90587e40ff12a3cf03c4c41729c3fcd722585568 100644 (file)
@@ -1,6 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
 ;; Ensure the store verifier is not overzealous
-; RUN: opt -newgvn -S %s | FileCheck %s
+; RUN: opt -newgvn -enable-phi-of-ops=true -S %s | FileCheck %s
 @b = external global i16, align 2
 
 define void @patatino() {
index 28f5eea03ced62c9e11cfccbe271f3bdb8a1932a..2117d0ee060602d6befd458f87ea8c30519000cf 100644 (file)
@@ -1,6 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt -newgvn -S < %s | FileCheck %s
-; RUN: opt -passes=newgvn -S -o - %s | FileCheck %s
+; RUN: opt -newgvn -enable-phi-of-ops=true -S < %s | FileCheck %s
+; RUN: opt -passes=newgvn -enable-phi-of-ops=true -S -o - %s | FileCheck %s
 
 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"