From: Chad Rosier Date: Thu, 10 Aug 2017 14:12:57 +0000 (+0000) Subject: [NewGVN] Add CL option to control the generation of phi-of-ops (disable by default). X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0db3a4f0417ad000835e08b00dca1046c050ee23;p=llvm [NewGVN] Add CL option to control the generation of phi-of-ops (disable by default). Differential Revision: https://reviews.llvm.org/D36478539 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310594 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Scalar/NewGVN.cpp b/lib/Transforms/Scalar/NewGVN.cpp index e620ae9c557..ceb53502f98 100644 --- a/lib/Transforms/Scalar/NewGVN.cpp +++ b/lib/Transforms/Scalar/NewGVN.cpp @@ -127,6 +127,10 @@ DEBUG_COUNTER(PHIOfOpsCounter, "newgvn-phi", static cl::opt EnableStoreRefinement("enable-store-refinement", cl::init(false), cl::Hidden); +/// Currently, the generation "phi of ops" can result in correctness issues. +static cl::opt 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(I) || isa(I) || isa(I) || isa(I); } diff --git a/test/Transforms/NewGVN/completeness.ll b/test/Transforms/NewGVN/completeness.ll index 1798bfea5fe..0b5a13ec2ed 100644 --- a/test/Transforms/NewGVN/completeness.ll +++ b/test/Transforms/NewGVN/completeness.ll @@ -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**) { diff --git a/test/Transforms/NewGVN/pr33461.ll b/test/Transforms/NewGVN/pr33461.ll index 0a41d6834a4..90587e40ff1 100644 --- a/test/Transforms/NewGVN/pr33461.ll +++ b/test/Transforms/NewGVN/pr33461.ll @@ -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() { diff --git a/test/Transforms/NewGVN/storeoverstore.ll b/test/Transforms/NewGVN/storeoverstore.ll index 28f5eea03ce..2117d0ee060 100644 --- a/test/Transforms/NewGVN/storeoverstore.ll +++ b/test/Transforms/NewGVN/storeoverstore.ll @@ -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"