llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.32k stars 12.12k forks source link

Invalid CodeGen for bool vectors #39770

Closed abique closed 5 years ago

abique commented 5 years ago
Bugzilla Link 40424
Resolution INVALID
Resolved on Sep 07, 2019 05:56
Version 7.0
OS All
Attachments bool-vector-0.nitro.llvm-ir
CC @RKSimon

Extended Description

Hi,

I found that there is invalid CodeGen for bool vectors, even before the lowering.

Please see the attached LLVM IR.

I compiled it with:

opt -O3 -march=native <bool-vector-0.nitro.llvm-ir -o tutu.bc llvm-dis tutu.bc

And then cat tutu.ll gives the following output:

; ModuleID = 'tutu.bc' source_filename = ""

; Function Attrs: norecurse nounwind readnone define i1 @​compute(<8 x float> %in) local_unnamed_addr #​0 { ret i1 true }

attributes #​0 = { norecurse nounwind readnone }

Which is wrong.

Regards, Alex

abique commented 5 years ago

I think this bug can be marked as closed.

abique commented 5 years ago

I updated my code generation to use insert element and extract element and it now works well.

abique commented 5 years ago

I now believe that my CodeGen is wrong but I thing that getelementptr should throw an error if it can't deliver the requested pointer.

abique commented 5 years ago

bool-vector-0.nitro Added source code, but this is not a public DSL.

abique commented 5 years ago

Hold on, maybe my codegen is wrong. It could be that I have to use extract elements with vectors of bool...

abique commented 5 years ago

I forgot to mention my computer details:

19-01-23 11:44:49 abique@knot:~> lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian Address sizes: 39 bits physical, 48 bits virtual CPU(s): 8 On-line CPU(s) list: 0-7 Thread(s) per core: 2 Core(s) per socket: 4 Socket(s): 1 NUMA node(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 94 Model name: Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz Stepping: 3 CPU MHz: 4169.444 CPU max MHz: 4200.0000 CPU min MHz: 800.0000 BogoMIPS: 8019.00 Virtualization: VT-x L1d cache: 32K L1i cache: 32K L2 cache: 256K L3 cache: 8192K NUMA node0 CPU(s): 0-7 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp flush_l1d 19-01-23 11:44:51 abique@knot:~> unam uname uname26@ 19-01-23 11:44:51 abique@knot:~> uname -a Linux knot 4.20.3-arch1-1-ARCH #​1 SMP PREEMPT Wed Jan 16 22:38:58 UTC 2019 x86_64 GNU/Linux 19-01-23 11:45:18 abique@knot:~> opt -version LLVM (http://llvm.org/): LLVM version 7.0.1 Optimized build. Default target: x86_64-pc-linux-gnu Host CPU: skylake 19-01-23 11:45:24 abique@knot:~>