summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
diff options
context:
space:
mode:
authorDavid Green <david.green@arm.com>2018-09-12 09:54:17 +0000
committerDavid Green <david.green@arm.com>2018-09-12 09:54:17 +0000
commit2352b30c9606e1323cfc39f141bdeb42bca858b1 (patch)
tree16736f9167759291d532189037bfcd39a6e8be04 /llvm/lib/Transforms/Utils/SimplifyCFG.cpp
parent7140363cd0122df50ba7d824eb448680b1f818c9 (diff)
downloadbcm5719-llvm-2352b30c9606e1323cfc39f141bdeb42bca858b1.tar.gz
bcm5719-llvm-2352b30c9606e1323cfc39f141bdeb42bca858b1.zip
[SimplifyCFG] Put an alignment on generated switch tables
Previously the alignment on the newly created switch table data was not set, meaning that DataLayout::getPreferredAlignment was free to overalign it to 16 bytes. This causes unnecessary code bloat. Differential Revision: https://reviews.llvm.org/D51800 llvm-svn: 342039
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyCFG.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index b2b8c248b99..422d1c9ef0a 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -5036,6 +5036,9 @@ SwitchLookupTable::SwitchLookupTable(
GlobalVariable::PrivateLinkage, Initializer,
"switch.table." + FuncName);
Array->setUnnamedAddr(GlobalValue::UnnamedAddr::Global);
+ // Set the alignment to that of an array items. We will be only loading one
+ // value out of it.
+ Array->setAlignment(DL.getPrefTypeAlignment(ValueType));
Kind = ArrayKind;
}
OpenPOWER on IntegriCloud