[llvm] r194221 - IR: Properly canonicalize PointerType in ConstantExpr GEPs

jahanian fjahanian at apple.com
Thu Nov 7 15:21:29 PST 2013


This patch breaks couple of tests on a Windows buildbot.

Failing Tests (2):
      Clang :: CodeGenCXX/for-range.cpp
      Clang :: CodeGenCXX/global-array-destruction.cpp

A sample of failure (with complete path replaced with … ) is below.

- Fariborz


Command 1 Stderr:
  C:\...\src\tools\clang\test\CodeGenCXX\global-array-destruction.cpp:59:11: error: expected string not found in input
  // CHECK: getelementptr inbounds ([2 x [3 x {{.*}}]]* @_ZGR1u, i64 1, i64 0, i64 0)
            ^
  <stdin>:327:29: note: scanning from here
   %1 = call i32 @__cxa_atexit(void (i8*)* @__cxx_global_array_dtor18, i8* null, i8* @__dso_handle) #0
                              ^
  <stdin>:339:59: note: possible intended match here
   %4 = phi %struct.T* [ getelementptr inbounds (%struct.T* getelementptr inbounds ([2 x [3 x %struct.T]]* @_ZGR1u, i32 0, i32 0, i32 0), i64 6), %1 ], [ %5, %3 ]
                                                            

On Nov 7, 2013, at 2:29 PM, David Majnemer <david.majnemer at gmail.com> wrote:

> Author: majnemer
> Date: Thu Nov  7 16:29:42 2013
> New Revision: 194221
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=194221&view=rev
> Log:
> IR: Properly canonicalize PointerType in ConstantExpr GEPs
> 
> No additional test was needed, Other/constant-fold-gep.ll detects this
> just fine.
> 
> Modified:
>    llvm/trunk/lib/IR/ConstantFold.cpp
> 
> Modified: llvm/trunk/lib/IR/ConstantFold.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/ConstantFold.cpp?rev=194221&r1=194220&r2=194221&view=diff
> ==============================================================================
> --- llvm/trunk/lib/IR/ConstantFold.cpp (original)
> +++ llvm/trunk/lib/IR/ConstantFold.cpp Thu Nov  7 16:29:42 2013
> @@ -1966,11 +1966,12 @@ static Constant *ConstantFoldGetElementP
>         else if (VectorType *VTy = dyn_cast<VectorType>(LastTy))
>           NumElements = VTy->getNumElements();
> 
> -        if (ConstantInt *CI = dyn_cast<ConstantInt>(Idx0)) {
> -          int64_t Idx0Val = CI->getSExtValue();
> -          if (NumElements > 0 && Idx0Val >= 0 &&
> -              (uint64_t)Idx0Val < NumElements)
> -            IsSequentialAccessInRange = true;
> +        if (NumElements > 0) {
> +          if (ConstantInt *CI = dyn_cast<ConstantInt>(Idx0)) {
> +            int64_t Idx0Val = CI->getSExtValue();
> +            if (Idx0Val >= 0 && (uint64_t)Idx0Val < NumElements)
> +              IsSequentialAccessInRange = true;
> +          }
>         } else if (PointerType *PTy = dyn_cast<PointerType>(LastTy))
>           // Only handle pointers to sized types, not pointers to functions.
>           if (PTy->getElementType()->isSized())
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131107/9bf02fe0/attachment.html>


More information about the llvm-commits mailing list