summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/BackendUtil.cpp
diff options
context:
space:
mode:
authorHal Finkel <hfinkel@anl.gov>2013-11-17 16:03:29 +0000
committerHal Finkel <hfinkel@anl.gov>2013-11-17 16:03:29 +0000
commitce0697f4759ce369bd28d31a6ed5813d776663de (patch)
treeb96cedb984121de7278a29fe711f8fc9d49e84b9 /clang/lib/CodeGen/BackendUtil.cpp
parent29aeb2051826e235a39545db3c891dc00f347730 (diff)
downloadbcm5719-llvm-ce0697f4759ce369bd28d31a6ed5813d776663de.tar.gz
bcm5719-llvm-ce0697f4759ce369bd28d31a6ed5813d776663de.zip
Add -freroll-loops to enable loop rerolling
This adds -freroll-loops (and -fno-reroll-loops in the usual way) to enable loop rerolling as part of the optimization pass manager. This transformation can enable vectorization, reduce code size (or both). Briefly, loop rerolling can transform a loop like this: for (int i = 0; i < 3200; i += 5) { a[i] += alpha * b[i]; a[i + 1] += alpha * b[i + 1]; a[i + 2] += alpha * b[i + 2]; a[i + 3] += alpha * b[i + 3]; a[i + 4] += alpha * b[i + 4]; } into this: for (int i = 0; i < 3200; ++i) { a[i] += alpha * b[i]; } Loop rerolling is currently disabled by default at all optimization levels. llvm-svn: 194967
Diffstat (limited to 'clang/lib/CodeGen/BackendUtil.cpp')
-rw-r--r--clang/lib/CodeGen/BackendUtil.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index e159a7ab5dc..90b0f68bd69 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -242,6 +242,7 @@ void EmitAssemblyHelper::CreatePasses(TargetMachine *TM) {
PMBuilder.DisableUnitAtATime = !CodeGenOpts.UnitAtATime;
PMBuilder.DisableUnrollLoops = !CodeGenOpts.UnrollLoops;
+ PMBuilder.RerollLoops = CodeGenOpts.RerollLoops;
if (!CodeGenOpts.SampleProfileFile.empty())
PMBuilder.addExtension(PassManagerBuilder::EP_EarlyAsPossible,
OpenPOWER on IntegriCloud