summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-09-01 23:09:27 +0000
committerChris Lattner <sabre@nondot.org>2010-09-01 23:09:27 +0000
commit8af45a889d44d40a72a85337d6db7a17594cb8f6 (patch)
tree7ba50d1ebfaad945af91992ae9e3e21a0cec3905
parent50391ba1950610ebe1814573a6a13a0498f0b4f9 (diff)
downloadbcm5719-llvm-8af45a889d44d40a72a85337d6db7a17594cb8f6.tar.gz
bcm5719-llvm-8af45a889d44d40a72a85337d6db7a17594cb8f6.zip
deepen my MMX/SRoA hack to avoid hurting non-x86 codegen.
llvm-svn: 112763
-rw-r--r--llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp10
-rw-r--r--llvm/test/Transforms/ScalarRepl/vector_promote.ll1
2 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
index c245b143273..fee317dbd9a 100644
--- a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
+++ b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
@@ -28,6 +28,7 @@
#include "llvm/Instructions.h"
#include "llvm/IntrinsicInst.h"
#include "llvm/LLVMContext.h"
+#include "llvm/Module.h"
#include "llvm/Pass.h"
#include "llvm/Analysis/Dominators.h"
#include "llvm/Target/TargetData.h"
@@ -197,7 +198,12 @@ private:
/// IsVerbotenVectorType - Return true if this is a vector type ScalarRepl isn't
/// allowed to form. We do this to avoid MMX types, which is a complete hack,
/// but is required until the backend is fixed.
-static bool IsVerbotenVectorType(const VectorType *VTy) {
+static bool IsVerbotenVectorType(const VectorType *VTy, const Instruction *I) {
+ StringRef Triple(I->getParent()->getParent()->getParent()->getTargetTriple());
+ if (!Triple.startswith("i386") &&
+ !Triple.startswith("x86_64"))
+ return false;
+
// Reject all the MMX vector types.
switch (VTy->getNumElements()) {
default: return false;
@@ -226,7 +232,7 @@ AllocaInst *ConvertToScalarInfo::TryConvert(AllocaInst *AI) {
// involved, then we probably really do have a union of vector/array.
const Type *NewTy;
if (VectorTy && VectorTy->isVectorTy() && HadAVector &&
- !IsVerbotenVectorType(cast<VectorType>(VectorTy))) {
+ !IsVerbotenVectorType(cast<VectorType>(VectorTy), AI)) {
DEBUG(dbgs() << "CONVERT TO VECTOR: " << *AI << "\n TYPE = "
<< *VectorTy << '\n');
NewTy = VectorTy; // Use the vector type.
diff --git a/llvm/test/Transforms/ScalarRepl/vector_promote.ll b/llvm/test/Transforms/ScalarRepl/vector_promote.ll
index 5287cbe38bf..fe55426b24a 100644
--- a/llvm/test/Transforms/ScalarRepl/vector_promote.ll
+++ b/llvm/test/Transforms/ScalarRepl/vector_promote.ll
@@ -1,5 +1,6 @@
; RUN: opt < %s -scalarrepl -S | FileCheck %s
target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64"
+target triple = "x86_64-apple-darwin10.0.0"
define void @test1(<4 x float>* %F, float %f) {
entry:
OpenPOWER on IntegriCloud