http://llvm.org/bugs/show_bug.cgi?id=9011
Summary: Constant folding cast for zero vectors is missing
Product: libraries
Version: trunk
Platform: PC
OS/Version: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: Core LLVM classes
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
There is missing constant folding of casting operation for vector of 0's.
Probably it is due to fact that vector of zeroes is described by
ConstantAggregateZero and its handling is missing from ConstantFolding.
As result some of the shaders when running with 'opt -std-compile-opts' may run
infinitely long time. See attached .ll for example.
To reproduce the bug just run attached .ll with 'opt -std-compile-opts'
The fix is inlined (due to its simplicity)
Index: lib/VMCore/ConstantFold.cpp
===================================================================
--- lib/VMCore/ConstantFold.cpp (revision 2460)
+++ lib/VMCore/ConstantFold.cpp (working copy)
@@ -553,6 +553,9 @@
return ConstantVector::get(DestVecTy, res);
}
+ if (ConstantAggregateZero *CZ = dyn_cast<ConstantAggregateZero>(V)) {
+ return Constant::getNullValue(DestTy);
+ }
// We actually have to do a cast now. Perform the cast according to the
// opcode specified.
switch (opc) {
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs