summaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar/SROA.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2012-10-13 10:49:30 +0000
committerChandler Carruth <chandlerc@gmail.com>2012-10-13 10:49:30 +0000
commitac104272d9fc42af8dc6853853b96d489685e5a7 (patch)
tree626d9ebac4330dd4b9a3e6fdde5ec3e1e647405c /lib/Transforms/Scalar/SROA.cpp
parent444dccecfc6c6d0dad4f400141a12f9ca76943d8 (diff)
downloadexternal_llvm-ac104272d9fc42af8dc6853853b96d489685e5a7.zip
external_llvm-ac104272d9fc42af8dc6853853b96d489685e5a7.tar.gz
external_llvm-ac104272d9fc42af8dc6853853b96d489685e5a7.tar.bz2
Speculatively harden the conversion logic. I have no idea if this will
help the dragonegg builders, and no test case at this point, but this was one dimly plausible case I spotted by inspection. Hopefully will get a testcase from those bots soon-ish, and will tidy this up with proper testing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165869 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/SROA.cpp')
-rw-r--r--lib/Transforms/Scalar/SROA.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/SROA.cpp b/lib/Transforms/Scalar/SROA.cpp
index 7e206f0..cb6da3b 100644
--- a/lib/Transforms/Scalar/SROA.cpp
+++ b/lib/Transforms/Scalar/SROA.cpp
@@ -2358,11 +2358,22 @@ private:
return false;
if (!NewTy->isSingleValueType() || !OldTy->isSingleValueType())
return false;
+
+ if (NewTy->isPointerTy() || OldTy->isPointerTy()) {
+ if (NewTy->isPointerTy() && OldTy->isPointerTy())
+ return true;
+ if (NewTy->isIntegerTy() || OldTy->isIntegerTy())
+ return true;
+ return false;
+ }
+
return true;
}
Value *convertValue(IRBuilder<> &IRB, Value *V, Type *Ty) {
assert(canConvertValue(V->getType(), Ty) && "Value not convertable to type");
+ if (V->getType() == Ty)
+ return V;
if (V->getType()->isIntegerTy() && Ty->isPointerTy())
return IRB.CreateIntToPtr(V, Ty);
if (V->getType()->isPointerTy() && Ty->isIntegerTy())