[PATCH] D63375: [ConstantFolding] Fix assertion failure on non-power-of-two vector load.

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 19 03:25:44 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL363784: [ConstantFolding] Fix assertion failure on non-power-of-two vector load. (authored by foad, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D63375?vs=204915&id=205535#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63375/new/

https://reviews.llvm.org/D63375

Files:
  llvm/trunk/lib/Analysis/ConstantFolding.cpp
  llvm/trunk/test/Transforms/InstSimplify/load.ll


Index: llvm/trunk/lib/Analysis/ConstantFolding.cpp
===================================================================
--- llvm/trunk/lib/Analysis/ConstantFolding.cpp
+++ llvm/trunk/lib/Analysis/ConstantFolding.cpp
@@ -515,7 +515,7 @@
       MapTy = Type::getInt64Ty(C->getContext());
     else if (LoadTy->isVectorTy()) {
       MapTy = PointerType::getIntNTy(C->getContext(),
-                                     DL.getTypeAllocSizeInBits(LoadTy));
+                                     DL.getTypeSizeInBits(LoadTy));
     } else
       return nullptr;
 
Index: llvm/trunk/test/Transforms/InstSimplify/load.ll
===================================================================
--- llvm/trunk/test/Transforms/InstSimplify/load.ll
+++ llvm/trunk/test/Transforms/InstSimplify/load.ll
@@ -28,3 +28,13 @@
   %load = load <8 x i32>, <8 x i32>* bitcast (i32* getelementptr ([8 x i32], [8 x i32]* @GV, i64 0, i64 -1) to <8 x i32>*)
   ret <8 x i32> %load
 }
+
+ at constvec = internal constant <3 x float> <float 0xBFDA20BC40000000, float 0xBFE6A09EE0000000, float 0x3FE279A760000000>
+
+; This does an out of bounds load from the global constant
+define <3 x float> @load_vec3() {
+; CHECK-LABEL: @load_vec3(
+; CHECK-NEXT:    ret <3 x float> undef
+  %1 = load <3 x float>, <3 x float>* getelementptr inbounds (<3 x float>, <3 x float>* @constvec, i64 1)
+  ret <3 x float> %1
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63375.205535.patch
Type: text/x-patch
Size: 1375 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190619/7ebb97b6/attachment.bin>


More information about the llvm-commits mailing list