diff options
author | Evan Cheng <evan.cheng@apple.com> | 2008-02-27 10:04:56 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2008-02-27 10:04:56 +0000 |
commit | be680dcea6858c438c6615326ae1c098ff448ae1 (patch) | |
tree | dede24ec0abc6c892079d926ea556dcca6adf5e5 | |
parent | e90a615f37aaee2ad9259c0ef21586d5e4142147 (diff) | |
download | external_llvm-be680dcea6858c438c6615326ae1c098ff448ae1.zip external_llvm-be680dcea6858c438c6615326ae1c098ff448ae1.tar.gz external_llvm-be680dcea6858c438c6615326ae1c098ff448ae1.tar.bz2 |
Don't track max alignment during stack object allocations since they can be deleted later. Let PEI compute it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47668 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/CodeGen/MachineFrameInfo.h | 4 | ||||
-rw-r--r-- | lib/CodeGen/PrologEpilogInserter.cpp | 3 | ||||
-rw-r--r-- | test/CodeGen/X86/2008-02-27-PEICrash.ll | 33 |
3 files changed, 34 insertions, 6 deletions
diff --git a/include/llvm/CodeGen/MachineFrameInfo.h b/include/llvm/CodeGen/MachineFrameInfo.h index 856fb34..4be3bd4 100644 --- a/include/llvm/CodeGen/MachineFrameInfo.h +++ b/include/llvm/CodeGen/MachineFrameInfo.h @@ -305,9 +305,6 @@ public: /// a postive identifier to represent it. /// int CreateStackObject(uint64_t Size, unsigned Alignment) { - // Keep track of the maximum alignment. - if (MaxAlignment < Alignment) MaxAlignment = Alignment; - assert(Size != 0 && "Cannot allocate zero size stack objects!"); Objects.push_back(StackObject(Size, Alignment, -1)); return Objects.size()-NumFixedObjects-1; @@ -331,7 +328,6 @@ public: /// int CreateVariableSizedObject() { HasVarSizedObjects = true; - if (MaxAlignment < 1) MaxAlignment = 1; Objects.push_back(StackObject(0, 1, -1)); return Objects.size()-NumFixedObjects-1; } diff --git a/lib/CodeGen/PrologEpilogInserter.cpp b/lib/CodeGen/PrologEpilogInserter.cpp index 3cc2aa6..3106455 100644 --- a/lib/CodeGen/PrologEpilogInserter.cpp +++ b/lib/CodeGen/PrologEpilogInserter.cpp @@ -475,8 +475,7 @@ void PEI::calculateFrameObjectOffsets(MachineFunction &Fn) { // Remember the required stack alignment in case targets need it to perform // dynamic stack alignment. - assert(FFI->getMaxAlignment() == MaxAlign && - "Stack alignment calculation broken!"); + FFI->setMaxAlignment(MaxAlign); } diff --git a/test/CodeGen/X86/2008-02-27-PEICrash.ll b/test/CodeGen/X86/2008-02-27-PEICrash.ll new file mode 100644 index 0000000..b644d8f --- /dev/null +++ b/test/CodeGen/X86/2008-02-27-PEICrash.ll @@ -0,0 +1,33 @@ +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 + +define i64 @__divsc3(float %a, float %b, float %c, float %d) nounwind readnone { +entry: + br i1 false, label %bb56, label %bb33 + +bb33: ; preds = %entry + br label %bb56 + +bb56: ; preds = %bb33, %entry + %tmp36.pn = phi float [ 0.000000e+00, %bb33 ], [ 0.000000e+00, %entry ] ; <float> [#uses=1] + %b.pn509 = phi float [ %b, %bb33 ], [ %a, %entry ] ; <float> [#uses=1] + %a.pn = phi float [ %a, %bb33 ], [ %b, %entry ] ; <float> [#uses=1] + %tmp41.pn508 = phi float [ 0.000000e+00, %bb33 ], [ 0.000000e+00, %entry ] ; <float> [#uses=1] + %tmp51.pn = phi float [ 0.000000e+00, %bb33 ], [ %a, %entry ] ; <float> [#uses=1] + %tmp44.pn = mul float %tmp36.pn, %b.pn509 ; <float> [#uses=1] + %tmp46.pn = add float %tmp44.pn, %a.pn ; <float> [#uses=1] + %tmp53.pn = sub float 0.000000e+00, %tmp51.pn ; <float> [#uses=1] + %x.0 = fdiv float %tmp46.pn, %tmp41.pn508 ; <float> [#uses=1] + %y.0 = fdiv float %tmp53.pn, 0.000000e+00 ; <float> [#uses=1] + br i1 false, label %bb433, label %bb98 + +bb98: ; preds = %bb56 + %tmp102 = mul float 0.000000e+00, %a ; <float> [#uses=1] + %tmp106 = mul float 0.000000e+00, %b ; <float> [#uses=1] + br label %bb433 + +bb433: ; preds = %bb98, %bb56 + %x.1 = phi float [ %tmp102, %bb98 ], [ %x.0, %bb56 ] ; <float> [#uses=0] + %y.1 = phi float [ %tmp106, %bb98 ], [ %y.0, %bb56 ] ; <float> [#uses=1] + %tmp460 = add float %y.1, 0.000000e+00 ; <float> [#uses=0] + ret i64 0 +} |