[PATCH] D26014: [ConstantFold] Get the correct vector type when folding a getelementptr instruction with vector indices

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 26 15:33:26 PDT 2016


On Wed, Oct 26, 2016 at 3:23 PM, Filipe Cabecinhas via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> Can we have mixed integer and vector indices (langref doesn't seem to forbid
> it)? If so, what happens if the first one is an integer, and then you get a
> vector of indices?
>

Thanks for your review Filipe. This is something I thought about
while writing the patch.
All the following are rejected, FWIW, but I'm not an expert in
`getelementptr`, and I'm not quite fond of the syntax, which I find a
little confusing.
If you have a specific example, I can try.

fluttershy at Sony-PC MINGW64 /c/miscompiles
$ ~/work/llvm-msvc/Debug/bin/opt.exe vector1.ll
C:\Users\fluttershy\work\llvm-msvc\Debug\bin\opt.exe: vector1.ll:2:28:
error: invalid getelementptr indices
  %el = getelementptr i64, <8 x i64*> undef, <8 x i64> undef, i64 0
                           ^

fluttershy at Sony-PC MINGW64 /c/miscompiles
$ ~/work/llvm-msvc/Debug/bin/opt.exe vector1.ll
C:\Users\fluttershy\work\llvm-msvc\Debug\bin\opt.exe: vector1.ll:2:28:
error: invalid getelementptr indices
  %el = getelementptr i64, i64* undef, <8 x i64> undef, i64 0
                           ^

fluttershy at Sony-PC MINGW64 /c/miscompiles
$ ~/work/llvm-msvc/Debug/bin/opt.exe vector1.ll
C:\Users\fluttershy\work\llvm-msvc\Debug\bin\opt.exe: vector1.ll:2:28:
error: invalid getelementptr indices
  %el = getelementptr i64, <8 x i64*> undef, i64 0, <8 x i64> undef
                           ^


--
Davide


More information about the llvm-commits mailing list