[llvm] r348230 - Reverting r348215
Ranjeet Singh via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 3 18:03:53 PST 2018
Author: rsingh
Date: Mon Dec 3 18:03:53 2018
New Revision: 348230
URL: http://llvm.org/viewvc/llvm-project?rev=348230&view=rev
Log:
Reverting r348215
Causing failures on ubsan buildbot boxes.
Added:
llvm/trunk/test/Assembler/2004-03-07-FunctionAddressAlignment.ll
- copied unchanged from r348214, llvm/trunk/test/Assembler/2004-03-07-FunctionAddressAlignment.ll
Removed:
llvm/trunk/test/Analysis/ConstantFolding/func-and-folding.ll
Modified:
llvm/trunk/lib/IR/ConstantFold.cpp
Modified: llvm/trunk/lib/IR/ConstantFold.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/ConstantFold.cpp?rev=348230&r1=348229&r2=348230&view=diff
==============================================================================
--- llvm/trunk/lib/IR/ConstantFold.cpp (original)
+++ llvm/trunk/lib/IR/ConstantFold.cpp Mon Dec 3 18:03:53 2018
@@ -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,8 +1077,10 @@ Constant *llvm::ConstantFoldBinaryInstru
isa<GlobalValue>(CE1->getOperand(0))) {
GlobalValue *GV = cast<GlobalValue>(CE1->getOperand(0));
- unsigned GVAlign =
- GV->getPointerAlignment(GV->getParent()->getDataLayout());
+ // 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();
Removed: llvm/trunk/test/Analysis/ConstantFolding/func-and-folding.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ConstantFolding/func-and-folding.ll?rev=348229&view=auto
==============================================================================
--- llvm/trunk/test/Analysis/ConstantFolding/func-and-folding.ll (original)
+++ llvm/trunk/test/Analysis/ConstantFolding/func-and-folding.ll (removed)
@@ -1,27 +0,0 @@
-; RUN: opt < %s -constprop -S -o - | FileCheck %s
-
-; Function Attrs: minsize norecurse nounwind optsize readnone
-define dso_local void @foo1() #0 {
-entry:
- ret void
-}
-
-; Function Attrs: minsize norecurse nounwind optsize readnone
-define dso_local void @foo2() align 4 {
-entry:
- ret void
-}
-
-; Function Attrs: minsize nounwind optsize
-define dso_local i32 @main() local_unnamed_addr #1 {
-entry:
-; CHECK: ptrtoint
- %call = tail call i32 bitcast (i32 (...)* @process to i32 (i32)*)(i32 and (i32 ptrtoint (void ()* @foo1 to i32), i32 2)) #3
-; CHECK-NEXT: ptrtoint
- %call2 = tail call i32 bitcast (i32 (...)* @process to i32 (i32)*)(i32 and (i32 ptrtoint (void ()* @foo2 to i32), i32 2)) #3
- ret i32 0
-}
-
-; Function Attrs: minsize optsize
-declare dso_local i32 @process(...) local_unnamed_addr #2
-
More information about the llvm-commits
mailing list