Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CodeGen] Forbid passing a PointerType to MVT::getVT and EVT::getEVT #92671

Merged
merged 1 commit into from
May 22, 2024

Conversation

jrtc27
Copy link
Collaborator

@jrtc27 jrtc27 commented May 18, 2024

There is the expectation throughout CodeGen that, for types representing "real" values, the MVT or EVT is self-contained. However, MVT::iPTR is challenging, because it has no address space, and even if it did, there often is no DataLayout immediately accessible to determine what actually is the underlying type.

Historically it was documented as being TableGen-only, but that was lost in 631bfdb's conversion to using the generated defines. Let's preserve that intent by not allowing it to originate through accidental calls to get(E)VT with a PointerType. If you need to support that, be sure to use something like TargetLowering's getValueType, which takes a DataLayout and can map pointers to their concrete MVTs. Whilst here, reintroduce documentation about these value types being TableGen-only.

@jrtc27
Copy link
Collaborator Author

jrtc27 commented May 18, 2024

NB: Depends on #92670 (merged)

Copy link

github-actions bot commented May 18, 2024

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff 7529fe2e92e79eef22a528a7168e4dd777d6e9bd 7fb0c673f38c0ff8913aff811b3b3bcac74b48d1 -- llvm/include/llvm/CodeGen/ValueTypes.h llvm/include/llvm/CodeGenTypes/MachineValueType.h llvm/lib/CodeGen/ValueTypes.cpp
View the diff from clang-format here.
diff --git a/llvm/lib/CodeGen/ValueTypes.cpp b/llvm/lib/CodeGen/ValueTypes.cpp
index 3d5c58d282..74d0128f84 100644
--- a/llvm/lib/CodeGen/ValueTypes.cpp
+++ b/llvm/lib/CodeGen/ValueTypes.cpp
@@ -612,7 +612,8 @@ MVT MVT::getVT(Type *Ty, bool HandleUnknown){
   }
   case Type::X86_AMXTyID:   return MVT(MVT::x86amx);
   case Type::FP128TyID:     return MVT(MVT::f128);
-  case Type::PPC_FP128TyID: return MVT(MVT::ppcf128);
+  case Type::PPC_FP128TyID:
+    return MVT(MVT::ppcf128);
   case Type::FixedVectorTyID:
   case Type::ScalableVectorTyID: {
     VectorType *VTy = cast<VectorType>(Ty);

@jrtc27 jrtc27 added llvm:globalisel llvm:SelectionDAG SelectionDAGISel as well labels May 21, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented May 21, 2024

@llvm/pr-subscribers-llvm-globalisel

@llvm/pr-subscribers-llvm-selectiondag

Author: Jessica Clarke (jrtc27)

Changes

There is the expectation throughout CodeGen that, for types representing "real" values, the MVT or EVT is self-contained. However, MVT::iPTR is challenging, because it has no address space, and even if it did, there often is no DataLayout immediately accessible to determine what actually is the underlying type.

Historically it was documented as being TableGen-only, but that was lost in 631bfdb's conversion to using the generated defines. Let's preserve that intent by not allowing it to originate through accidental calls to get(E)VT with a PointerType. If you need to support that, be sure to use something like TargetLowering's getValueType, which takes a DataLayout and can map pointers to their concrete MVTs.


Full diff: https://github.com/llvm/llvm-project/pull/92671.diff

3 Files Affected:

  • (modified) llvm/include/llvm/CodeGen/ValueTypes.h (+2-2)
  • (modified) llvm/include/llvm/CodeGenTypes/MachineValueType.h (+3-3)
  • (modified) llvm/lib/CodeGen/ValueTypes.cpp (+6-7)
diff --git a/llvm/include/llvm/CodeGen/ValueTypes.h b/llvm/include/llvm/CodeGen/ValueTypes.h
index b66c66d1bfc45..a4d57fba7a7a0 100644
--- a/llvm/include/llvm/CodeGen/ValueTypes.h
+++ b/llvm/include/llvm/CodeGen/ValueTypes.h
@@ -488,8 +488,8 @@ namespace llvm {
     Type *getTypeForEVT(LLVMContext &Context) const;
 
     /// Return the value type corresponding to the specified type.
-    /// This returns all pointers as iPTR.  If HandleUnknown is true, unknown
-    /// types are returned as Other, otherwise they are invalid.
+    /// If HandleUnknown is true, unknown types are returned as Other,
+    /// otherwise they are invalid.
     static EVT getEVT(Type *Ty, bool HandleUnknown = false);
 
     intptr_t getRawBits() const {
diff --git a/llvm/include/llvm/CodeGenTypes/MachineValueType.h b/llvm/include/llvm/CodeGenTypes/MachineValueType.h
index 9aceb9896021c..f3280d0276399 100644
--- a/llvm/include/llvm/CodeGenTypes/MachineValueType.h
+++ b/llvm/include/llvm/CodeGenTypes/MachineValueType.h
@@ -476,9 +476,9 @@ namespace llvm {
       return getVectorVT(VT, EC.getKnownMinValue());
     }
 
-    /// Return the value type corresponding to the specified type.  This returns
-    /// all pointers as iPTR.  If HandleUnknown is true, unknown types are
-    /// returned as Other, otherwise they are invalid.
+    /// Return the value type corresponding to the specified type.
+    /// If HandleUnknown is true, unknown types are returned as Other,
+    /// otherwise they are invalid.
     static MVT getVT(Type *Ty, bool HandleUnknown = false);
 
   public:
diff --git a/llvm/lib/CodeGen/ValueTypes.cpp b/llvm/lib/CodeGen/ValueTypes.cpp
index 58db686ec7d57..38d2438f76b9d 100644
--- a/llvm/lib/CodeGen/ValueTypes.cpp
+++ b/llvm/lib/CodeGen/ValueTypes.cpp
@@ -579,9 +579,9 @@ Type *EVT::getTypeForEVT(LLVMContext &Context) const {
   // clang-format on
 }
 
-/// Return the value type corresponding to the specified type.  This returns all
-/// pointers as MVT::iPTR.  If HandleUnknown is true, unknown types are returned
-/// as Other, otherwise they are invalid.
+/// Return the value type corresponding to the specified type.
+/// If HandleUnknown is true, unknown types are returned as Other, otherwise
+/// they are invalid.
 MVT MVT::getVT(Type *Ty, bool HandleUnknown){
   assert(Ty != nullptr && "Invalid type");
   switch (Ty->getTypeID()) {
@@ -611,7 +611,6 @@ MVT MVT::getVT(Type *Ty, bool HandleUnknown){
   case Type::X86_AMXTyID:   return MVT(MVT::x86amx);
   case Type::FP128TyID:     return MVT(MVT::f128);
   case Type::PPC_FP128TyID: return MVT(MVT::ppcf128);
-  case Type::PointerTyID:   return MVT(MVT::iPTR);
   case Type::FixedVectorTyID:
   case Type::ScalableVectorTyID: {
     VectorType *VTy = cast<VectorType>(Ty);
@@ -622,9 +621,9 @@ MVT MVT::getVT(Type *Ty, bool HandleUnknown){
   }
 }
 
-/// getEVT - Return the value type corresponding to the specified type.  This
-/// returns all pointers as MVT::iPTR.  If HandleUnknown is true, unknown types
-/// are returned as Other, otherwise they are invalid.
+/// getEVT - Return the value type corresponding to the specified type.
+/// If HandleUnknown is true, unknown types are returned as Other, otherwise
+/// they are invalid.
 EVT EVT::getEVT(Type *Ty, bool HandleUnknown){
   switch (Ty->getTypeID()) {
   default:

/// This returns all pointers as iPTR. If HandleUnknown is true, unknown
/// types are returned as Other, otherwise they are invalid.
/// If HandleUnknown is true, unknown types are returned as Other,
/// otherwise they are invalid.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe should make a note about pointer handling?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. I should also add to the comment in MachineValueTypes.td like used to be in the .h.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments updated, including ValueTypes.td itself

There is the expectation throughout CodeGen that, for types representing
"real" values, the MVT or EVT is self-contained. However, MVT::iPTR is
challenging, because it has no address space, and even if it did, there
often is no DataLayout immediately accessible to determine what actually
is the underlying type.

Historically it was documented as being TableGen-only, but that was lost
in 631bfdb's conversion to using the
generated defines. Let's preserve that intent by not allowing it to
originate through accidental calls to get(E)VT with a PointerType. If
you need to support that, be sure to use something like TargetLowering's
getValueType, which takes a DataLayout and can map pointers to their
concrete MVTs. Whilst here, reintroduce documentation about these value
types being TableGen-only.
@jrtc27 jrtc27 merged commit 7c937df into llvm:main May 22, 2024
2 of 4 checks passed
@jrtc27 jrtc27 deleted the mvt-getvt-forbid-pointer branch May 22, 2024 22:56
@jplehr
Copy link
Contributor

jplehr commented May 27, 2024

I believe this broke the build of miniQMC with the following assertion.

Unknown type!
UNREACHABLE executed at /work1/omp-nightly/build/git/trunk19.0/llvm-project/llvm/lib/CodeGen/ValueTypes.cpp:592!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: /mnt/COD/2024-05-27/trunk_19.0-0/bin/clang-19 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -disable-free -clear-ast-before-backend -main-file-name catch_main.cpp -mrelocation-model static -mframe-pointer=none -menable-no-infs -menable-no-nans -fapprox-func -funsafe-math-optimizations -fno-signed-zeros -mreassociate -freciprocal-math -ffp-contract=fast -fno-rounding-math -ffast-math -ffinite-math-only -complex-range=basic -mconstructor-aliases -funwind-tables=2 -target-cpu znver4 -target-feature +prfchw -target-feature -cldemote -target-feature +avx -target-feature +aes -target-feature +sahf -target-feature +pclmul -target-feature -xop -target-feature +crc32 -target-feature +xsaves -target-feature -avx512fp16 -target-feature -usermsr -target-feature -sm4 -target-feature -egpr -target-feature +sse4.1 -target-feature +avx512ifma -target-feature +xsave -target-feature +sse4.2 -target-feature -tsxldtrk -target-feature -sm3 -target-feature -ptwrite -target-feature -widekl -target-feature +invpcid -target-feature +64bit -target-feature +xsavec -target-feature -avx10.1-512 -target-feature +avx512vpopcntdq -target-feature +cmov -target-feature -avx512vp2intersect -target-feature +avx512cd -target-feature +movbe -target-feature -avxvnniint8 -target-feature -ccmp -target-feature -amx-int8 -target-feature -kl -target-feature -avx10.1-256 -target-feature +evex512 -target-feature -avxvnni -target-feature -rtm -target-feature +adx -target-feature +avx2 -target-feature -hreset -target-feature -movdiri -target-feature -serialize -target-feature -sha512 -target-feature +vpclmulqdq -target-feature +avx512vl -target-feature -uintr -target-feature -cf -target-feature +clflushopt -target-feature -raoint -target-feature -cmpccxadd -target-feature +bmi -target-feature -amx-tile -target-feature +sse -target-feature +gfni -target-feature -avxvnniint16 -target-feature -amx-fp16 -target-feature -ndd -target-feature +xsaveopt -target-feature +rdrnd -target-feature +avx512f -target-feature -amx-bf16 -target-feature +avx512bf16 -target-feature +avx512vnni -target-feature -push2pop2 -target-feature +cx8 -target-feature +avx512bw -target-feature +sse3 -target-feature +pku -target-feature +fsgsbase -target-feature +clzero -target-feature +mwaitx -target-feature -lwp -target-feature +lzcnt -target-feature +sha -target-feature -movdir64b -target-feature -ppx -target-feature +wbnoinvd -target-feature -enqcmd -target-feature -avxneconvert -target-feature -tbm -target-feature -pconfig -target-feature -amx-complex -target-feature +ssse3 -target-feature +cx16 -target-feature +bmi2 -target-feature +fma -target-feature +popcnt -target-feature -avxifma -target-feature +f16c -target-feature +avx512bitalg -target-feature +rdpru -target-feature +clwb -target-feature +mmx -target-feature +sse2 -target-feature +rdseed -target-feature +avx512vbmi2 -target-feature -prefetchi -target-feature +rdpid -target-feature -fma4 -target-feature +avx512vbmi -target-feature +shstk -target-feature +vaes -target-feature -waitpkg -target-feature -sgx -target-feature +fxsr -target-feature +avx512dq -target-feature +sse4a -debugger-tuning=gdb -fdebug-compilation-dir=/home/janplehr/git/aomp-test/miniqmc_build/build_aomp_clang/src/Utilities -fcoverage-compilation-dir=/home/janplehr/git/aomp-test/miniqmc_build/build_aomp_clang/src/Utilities -resource-dir /mnt/COD/2024-05-27/trunk_19.0-0/lib/clang/19 -O3 -Wvla -Wall -Wno-unused-variable -Wno-overloaded-virtual -Wno-unused-private-field -Wno-unused-local-typedef -Wno-unknown-pragmas -Wmisleading-indentation -Wno-linker-warnings -std=c++17 -ferror-limit 19 -fopenmp -fopenmp-assume-no-thread-state -fopenmp-assume-no-nested-parallelism -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -vectorize-loops -vectorize-slp -fembed-offload-object=/tmp/catch_main-029a51.out -fopenmp-targets=amdgcn-amd-amdhsa -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o CMakeFiles/catch_main.dir/catch_main.cpp.o -x ir /tmp/catch_main-7afc88.bc
1.      Optimizer
 #0 0x00007f7943272bef llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/mnt/COD/2024-05-27/trunk_19.0-0/bin/../lib/libLLVMSupport.so.19.0git+0x1e2bef)
 #1 0x00007f7943270144 SignalHandler(int) Signals.cpp:0:0
 #2 0x00007f7942a42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x00007f7942a969fc __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #4 0x00007f7942a969fc __pthread_kill_internal ./nptl/pthread_kill.c:78:10
 #5 0x00007f7942a969fc pthread_kill ./nptl/pthread_kill.c:89:10
 #6 0x00007f7942a42476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
 #7 0x00007f7942a287f3 abort ./stdlib/abort.c:81:7
 #8 0x00007f794318bc0e (/mnt/COD/2024-05-27/trunk_19.0-0/bin/../lib/libLLVMSupport.so.19.0git+0xfbc0e)
 #9 0x00007f7946d3dae6 (/mnt/COD/2024-05-27/trunk_19.0-0/bin/../lib/libLLVMCodeGen.so.19.0git+0x764ae6)
#10 0x00007f7949a2b8d3 llvm::X86TTIImpl::getInterleavedMemoryOpCostAVX512(unsigned int, llvm::FixedVectorType*, unsigned int, llvm::ArrayRef<unsigned int>, llvm::Align, unsigned int, llvm::TargetTransformInfo::TargetCostKind, bool, bool) (/mnt/COD/2024-05-27/trunk_19.0-0/bin/../lib/libLLVMX86CodeGen.so.19.0git+0x41e8d3)
#11 0x00007f7949a2ce16 llvm::X86TTIImpl::getInterleavedMemoryOpCost(unsigned int, llvm::Type*, unsigned int, llvm::ArrayRef<unsigned int>, llvm::Align, unsigned int, llvm::TargetTransformInfo::TargetCostKind, bool, bool) (/mnt/COD/2024-05-27/trunk_19.0-0/bin/../lib/libLLVMX86CodeGen.so.19.0git+0x41fe16)
#12 0x00007f7943ff5ca6 llvm::TargetTransformInfo::getInterleavedMemoryOpCost(unsigned int, llvm::Type*, unsigned int, llvm::ArrayRef<unsigned int>, llvm::Align, unsigned int, llvm::TargetTransformInfo::TargetCostKind, bool, bool) const (/mnt/COD/2024-05-27/trunk_19.0-0/bin/../lib/libLLVMAnalysis.so.19.0git+0x46dca6)
#13 0x00007f7945e5f6a1 llvm::LoopVectorizationCostModel::getInterleaveGroupCost(llvm::Instruction*, llvm::ElementCount) (/mnt/COD/2024-05-27/trunk_19.0-0/bin/../lib/libLLVMVectorize.so.19.0git+0x836a1)
#14 0x00007f7945e79261 llvm::LoopVectorizationCostModel::setCostBasedWideningDecision(llvm::ElementCount) (/mnt/COD/2024-05-27/trunk_19.0-0/bin/../lib/libLLVMVectorize.so.19.0git+0x9d261)
#15 0x00007f7945e9aca2 llvm::LoopVectorizationPlanner::plan(llvm::ElementCount, unsigned int) (/mnt/COD/2024-05-27/trunk_19.0-0/bin/../lib/libLLVMVectorize.so.19.0git+0xbeca2)
#16 0x00007f7945e9dfaf llvm::LoopVectorizePass::processLoop(llvm::Loop*) (/mnt/COD/2024-05-27/trunk_19.0-0/bin/../lib/libLLVMVectorize.so.19.0git+0xc1faf)
#17 0x00007f7945ea114d llvm::LoopVectorizePass::runImpl(llvm::Function&, llvm::ScalarEvolution&, llvm::LoopInfo&, llvm::TargetTransformInfo&, llvm::DominatorTree&, llvm::BlockFrequencyInfo*, llvm::TargetLibraryInfo*, llvm::DemandedBits&, llvm::AssumptionCache&, llvm::LoopAccessInfoManager&, llvm::OptimizationRemarkEmitter&, llvm::ProfileSummaryInfo*) (/mnt/COD/2024-05-27/trunk_19.0-0/bin/../lib/libLLVMVectorize.so.19.0git+0xc514d)                                                                                                                                                                                                                                                                                                                                                                                                                    
#18 0x00007f7945ea2360 llvm::LoopVectorizePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/mnt/COD/2024-05-27/trunk_19.0-0/bin/../lib/libLLVMVectorize.so.19.0git+0xc6360)                                                                                                                                                                                                                                     
#19 0x00007f7941ce5356 llvm::detail::PassModel<llvm::Function, llvm::LoopVectorizePass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/mnt/COD/2024-05-27/trunk_19.0-0/bin/../lib/../lib/libLLVMPasses.so.19.0git+0x6f356)                                                                                                                                                
#20 0x00007f79436c548d llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/mnt/COD/2024-05-27/trunk_19.0-0/bin/../lib/libLLVMCore.so.19.0git+0x32148d)                                                                                                                                                                                        
#21 0x00007f79496b6166 llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/mnt/COD/2024-05-27/trunk_19.0-0/bin/../lib/libLLVMX86CodeGen.so.19.0git+0xa9166)
#22 0x00007f79436c3cfd llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/mnt/COD/2024-05-27/trunk_19.0-0/bin/../lib/libLLVMCore.so.19.0git+0x31fcfd)                                                                                                                                                                                                                                   
#23 0x00007f79496b7356 llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/mnt/COD/2024-05-27/trunk_19.0-0/bin/../lib/libLLVMX86CodeGen.so.19.0git+0xaa356)                                                                                                                                                  
#24 0x00007f79436c1b9d llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/mnt/COD/2024-05-27/trunk_19.0-0/bin/../lib/libLLVMCore.so.19.0git+0x31db9d)                                                                                                                                                                                                
#25 0x00007f79471b3eb8 (anonymous namespace)::EmitAssemblyHelper::RunOptimizationPipeline(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>&, std::unique_ptr<llvm::ToolOutputFile, std::default_delete<llvm::ToolOutputFile>>&, clang::BackendConsumer*) BackendUtil.cpp:0:0                                                                                           
#26 0x00007f79471b7695 (anonymous namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) BackendUtil.cpp:0:0                                                                                                                                                                                          
#27 0x00007f79471b7d46 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) (/mnt/COD/2024-05-27/trunk_19.0-0/bin/../lib/libclangCodeGen.so.19.0git+0x115d46)                                                                                                                                                                                                                                                                                                                                                         
#28 0x00007f79476b5e90 clang::CodeGenAction::ExecuteAction() (/mnt/COD/2024-05-27/trunk_19.0-0/bin/../lib/libclangCodeGen.so.19.0git+0x613e90)                                                                                                                                                                                                                                                                                     
#29 0x00007f7945caa4d9 clang::FrontendAction::Execute() (/mnt/COD/2024-05-27/trunk_19.0-0/bin/../lib/libclangFrontend.so.19.0git+0x1614d9)                                                                                                                                                                                                                                                                                         
#30 0x00007f7945c2294e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/mnt/COD/2024-05-27/trunk_19.0-0/bin/../lib/libclangFrontend.so.19.0git+0xd994e)                                                                                                                                                                                                                                                            
#31 0x00007f7948115706 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/mnt/COD/2024-05-27/trunk_19.0-0/bin/../lib/libclangFrontendTool.so.19.0git+0x5706)                                                                                                                                                                                                                                                             
#32 0x0000564e1faec03c cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/mnt/COD/2024-05-27/trunk_19.0-0/bin/clang-19+0x1403c)                                                                                                                                                                                                                                                                                           
#33 0x0000564e1fae525a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0                                                                                                                                                                                                                                                                                                                
#34 0x0000564e1fae8c1e clang_main(int, char**, llvm::ToolContext const&) (/mnt/COD/2024-05-27/trunk_19.0-0/bin/clang-19+0x10c1e)                                                                                                                                                                                                                                                                                                   
#35 0x0000564e1fae4c8b main (/mnt/COD/2024-05-27/trunk_19.0-0/bin/clang-19+0xcc8b)                                                                                                                                                                                                                                                                                                                                                 
#36 0x00007f7942a29d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16                                                                                                                                                                                                                                                                                                                                   
#37 0x00007f7942a29e40 call_init ./csu/../csu/libc-start.c:128:20                                                                                                                                                                                                                                                                                                                                                                  
#38 0x00007f7942a29e40 __libc_start_main ./csu/../csu/libc-start.c:379:5                                                                                                                                                                                                                                                                                                                                                           
#39 0x0000564e1fae4cee _start (/mnt/COD/2024-05-27/trunk_19.0-0/bin/clang-19+0xccee)                                                                                                                                                                                                                                                                                                                                               
clang++: error: unable to execute command: Aborted (core dumped)                                                                                                                                                                                                                                                                                                                                                                   
clang++: error: clang frontend command failed due to signal (use -v to see invocation)                                                                                                                                                                                                                                                                                                                                             
clang version 19.0.0git (https://github.com/llvm/llvm-project 686600b521aa3ca5fb9f015d25636067e2c5c9fa)                                                                                                                                                                                                                                                                                                                            
Target: x86_64-unknown-linux-gnu                                                                                                                                                                                                                                                                                                                                                                                                   
Thread model: posix                                                                                                                                                                                                                                                                                                                                                                                                                
InstalledDir: /mnt/COD/2024-05-27/trunk_19.0-0/bin                                                                                                                                                                                                                                                                                                                                                                                 
Build config: +assertions                                                                                                                                                                                                                                                                                                                                                                                                          
Configuration file: /mnt/COD/2024-05-27/trunk_19.0-0/bin/clang++.cfg                                                                                                                                                                                                                                                                                                                                                               
clang++: note: diagnostic msg:                                                                                                                                                                                                                                                                                                                                                                                                     
********************

jplehr added a commit to jplehr/llvm-project that referenced this pull request May 27, 2024
This is a temporary workaround for the build issues we are observing
after llvm#92671.
It re-enables the handling of pointer types by simply passing the
HandleUnknown flag to getVT set to true whenever a PointerTy is
encountered.
jplehr added a commit to jplehr/llvm-project that referenced this pull request May 27, 2024
This uses the TargetLowering getSimpleValueType mechanism to retrieve the
ValueType info and work around a build issue we were seeing for the
miniQMC application after
llvm#92671.
jplehr added a commit to jplehr/llvm-project that referenced this pull request May 28, 2024
This uses the TargetLowering getSimpleValueType mechanism to retrieve the
ValueType info and work around a build issue we were seeing for the
miniQMC application after
llvm#92671.

The test is reduced from that specific application and reproduces the
issue with the loop-vectorizer pass. However, to me, it seemed that the
issue was coming from the cost model.
jplehr added a commit to jplehr/llvm-project that referenced this pull request May 28, 2024
This uses the TargetLowering getSimpleValueType mechanism to retrieve the
ValueType info and work around a build issue we were seeing for the
miniQMC application after
llvm#92671.

The test is reduced from that specific application and reproduces the
issue with the loop-vectorizer pass. However, to me, it seemed that the
issue was coming from the cost model.
jplehr added a commit to jplehr/llvm-project that referenced this pull request May 28, 2024
This uses the TargetLowering getSimpleValueType mechanism to retrieve the
ValueType info and work around a build issue we were seeing for the
miniQMC application after
llvm#92671.

The test is reduced from that specific application and reproduces the
issue with the loop-vectorizer pass. However, to me, it seemed that the
issue was coming from the cost model.
jplehr added a commit that referenced this pull request May 29, 2024
This uses the TargetLowering getSimpleValueType mechanism to retrieve
the ValueType info inside the X86 cost model.

This resolves a build issue we were seeing for the miniQMC application after
#92671.
jameshu15869 pushed a commit to jameshu15869/llvm-project that referenced this pull request May 31, 2024
…lvm#92671)

There is the expectation throughout CodeGen that, for types representing
"real" values, the MVT or EVT is self-contained. However, MVT::iPTR is
challenging, because it has no address space, and even if it did, there
often is no DataLayout immediately accessible to determine what actually
is the underlying type.

Historically it was documented as being TableGen-only, but that was lost
in 631bfdb's conversion to using the
generated defines. Let's preserve that intent by not allowing it to
originate through accidental calls to get(E)VT with a PointerType. If
you need to support that, be sure to use something like TargetLowering's
getValueType, which takes a DataLayout and can map pointers to their
concrete MVTs. Whilst here, reintroduce documentation about these value
types being TableGen-only.
jameshu15869 pushed a commit to jameshu15869/llvm-project that referenced this pull request May 31, 2024
This uses the TargetLowering getSimpleValueType mechanism to retrieve
the ValueType info inside the X86 cost model.

This resolves a build issue we were seeing for the miniQMC application after
llvm#92671.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
llvm:globalisel llvm:SelectionDAG SelectionDAGISel as well
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants