[llvm-commits] [llvm] r165869 - /llvm/trunk/lib/Transforms/Scalar/SROA.cpp
Chandler Carruth
chandlerc at gmail.com
Sat Oct 13 03:49:30 PDT 2012
Author: chandlerc
Date: Sat Oct 13 05:49:30 2012
New Revision: 165869
URL: http://llvm.org/viewvc/llvm-project?rev=165869&view=rev
Log:
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.
Modified:
llvm/trunk/lib/Transforms/Scalar/SROA.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/SROA.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SROA.cpp?rev=165869&r1=165868&r2=165869&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/SROA.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/SROA.cpp Sat Oct 13 05:49:30 2012
@@ -2358,11 +2358,22 @@
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())
More information about the llvm-commits
mailing list