[PATCH] D21568: Invoke simplifycfg and sroa before instcombine.

Dehao Chen via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 21 13:16:54 PDT 2016


danielcdh created this revision.
danielcdh added reviewers: davidxl, wmi, dnovillo.
danielcdh added a subscriber: llvm-commits.

InstCombine needs to be performed after simplifycfg and sroa, otherwise it may make bad optimization decisions.

http://reviews.llvm.org/D21568

Files:
  lib/CodeGen/BackendUtil.cpp
  test/CodeGen/pgo-sample.c

Index: test/CodeGen/pgo-sample.c
===================================================================
--- test/CodeGen/pgo-sample.c
+++ test/CodeGen/pgo-sample.c
@@ -2,5 +2,8 @@
 //
 // Ensure Pass PGOInstrumentationGenPass is invoked.
 // RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample.prof %s -mllvm -debug-pass=Structure -emit-llvm -o - 2>&1 | FileCheck %s
+// CHECK: Simplify the CFG
+// CHECK: SROA
+// CHECK: Combine redundant instructions
 // CHECK: Remove unused exception handling info
 // CHECK: Sample profile pass
Index: lib/CodeGen/BackendUtil.cpp
===================================================================
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -180,6 +180,8 @@
 
 static void addInstructionCombiningPass(const PassManagerBuilder &Builder,
                                         legacy::PassManagerBase &PM) {
+  PM.add(createCFGSimplificationPass());
+  PM.add(createSROAPass());
   PM.add(createInstructionCombiningPass());
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21568.61433.patch
Type: text/x-patch
Size: 998 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160621/ed11a360/attachment.bin>


More information about the llvm-commits mailing list