[LLVMbugs] [Bug 9011] New: Constant folding cast for zero vectors is missing

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jan 20 04:08:28 PST 2011


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: unassignedbugs at nondot.org
        ReportedBy: artiom.myaskouvskey at intel.com
                CC: llvmbugs at cs.uiuc.edu


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.



More information about the llvm-bugs mailing list