summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/ConstantFold.cpp
diff options
context:
space:
mode:
authorRanjeet Singh <Ranjeet.Singh@arm.com>2019-01-04 16:39:10 +0000
committerRanjeet Singh <Ranjeet.Singh@arm.com>2019-01-04 16:39:10 +0000
commit107dd2565c2e980174367185a27f975229d30dc7 (patch)
treec4dd72055a8b38a670f9d18aa32b0d057dea77c6 /llvm/lib/IR/ConstantFold.cpp
parent71d61567c059f5e91d623805e00f9b4ecf966186 (diff)
downloadbcm5719-llvm-107dd2565c2e980174367185a27f975229d30dc7.tar.gz
bcm5719-llvm-107dd2565c2e980174367185a27f975229d30dc7.zip
Revert patches 348835 and 348571 because they're
causing code size performance regressions. llvm-svn: 350402
Diffstat (limited to 'llvm/lib/IR/ConstantFold.cpp')
-rw-r--r--llvm/lib/IR/ConstantFold.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp
index 826199ee054..57de6b04230 100644
--- a/llvm/lib/IR/ConstantFold.cpp
+++ b/llvm/lib/IR/ConstantFold.cpp
@@ -27,7 +27,6 @@
#include "llvm/IR/GlobalAlias.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/Instructions.h"
-#include "llvm/IR/Module.h"
#include "llvm/IR/Operator.h"
#include "llvm/IR/PatternMatch.h"
#include "llvm/Support/ErrorHandling.h"
@@ -1078,10 +1077,10 @@ Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode, Constant *C1,
isa<GlobalValue>(CE1->getOperand(0))) {
GlobalValue *GV = cast<GlobalValue>(CE1->getOperand(0));
- unsigned GVAlign =
- GV->getParent()
- ? GV->getPointerAlignment(GV->getParent()->getDataLayout())
- : 0;
+ // Functions are at least 4-byte aligned.
+ unsigned GVAlign = GV->getAlignment();
+ if (isa<Function>(GV))
+ GVAlign = std::max(GVAlign, 4U);
if (GVAlign > 1) {
unsigned DstWidth = CI2->getType()->getBitWidth();
OpenPOWER on IntegriCloud