[llvm] [InstCombine] Support DemandElts in SimplifyDemandedFPClass (PR #174176)

Kewen Meng via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 2 10:56:31 PST 2026


Kewen12 wrote:

Hi! It seems that this PR caused our blender test failed. Could you please take a look? Thanks!

bot: https://lab.llvm.org/buildbot/#/builders/123/builds/32907

>clang-22: /home/botworker/bbot/clang-hip-vega20/llvm-project/llvm/include/llvm/ADT/APInt.h:1045: bool llvm::APInt::operator[](unsigned int) const: Assertion `bitPosition < getBitWidth() && "Bit position out of bounds!"' failed.

```
1.	<eof> parser at end of file
2.	Optimizer
3.	Running pass "function<eager-inv>(drop-unnecessary-assumes,float2int,lower-constant-intrinsics,chr,loop(loop-rotate<header-duplication;no-prepare-for-lto>,loop-deletion),loop-distribute,inject-tli-mappings,loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>,drop-unnecessary-assumes,infer-alignment,loop-load-elim,instcombine<max-iterations=1;no-verify-fixpoint>,simplifycfg<bonus-inst-threshold=1;forward-switch-cond;switch-range-to-icmp;switch-to-arithmetic;switch-to-lookup;no-keep-loops;hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,slp-vectorizer,vector-combine,instcombine<max-iterations=1;no-verify-fixpoint>,loop-unroll<O3>,transform-warning,sroa<preserve-cfg>,infer-alignment,instcombine<max-iterations=1;no-verify-fixpoint>,loop-mssa(licm<allowspeculation>),alignment-from-assumptions,infer-address-spaces,loop-sink,instsimplify,div-rem-pairs,tailcallelim,simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;switch-to-arithmetic;no-switch-to-lookup;keep-loops;no-hoist-common-insts;hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;speculate-unpredictables>)" on module "/opt/botworker/llvm/External/hip/blender-4.1.1-linux-x64/4.1/scripts/addons/cycles/source/kernel/device/hip/kernel.cpp"
4.	Running pass "instcombine<max-iterations=1;no-verify-fixpoint>" on function "_Z31kernel_tex_image_interp_bicubicIfET_RK11TextureInfoff"
 #0 0x00005bd93efa49f0 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/bin/clang-22+0x2beb9f0)
 #1 0x00005bd93efa16af llvm::sys::RunSignalHandlers() (/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/bin/clang-22+0x2be86af)
 #2 0x00005bd93efa1802 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #3 0x00007190aec20520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00007190aec749fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x00007190aec20476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x00007190aec067f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x00007190aec0671b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #8 0x00007190aec17e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #9 0x00005bd93df6562e (/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/bin/clang-22+0x1bac62e)
#10 0x00005bd93df93ce6 computeKnownFPClass(llvm::Value const*, llvm::APInt const&, llvm::FPClassTest, llvm::KnownFPClass&, llvm::SimplifyQuery const&, unsigned int) (.part.0) ValueTracking.cpp:0:0
#11 0x00005bd93df94554 computeKnownFPClass(llvm::Value const*, llvm::APInt const&, llvm::FPClassTest, llvm::KnownFPClass&, llvm::SimplifyQuery const&, unsigned int) (.part.0) ValueTracking.cpp:0:0
#12 0x00005bd93df95737 computeKnownFPClass(llvm::Value const*, llvm::APInt const&, llvm::FPClassTest, llvm::KnownFPClass&, llvm::SimplifyQuery const&, unsigned int) (.part.0) ValueTracking.cpp:0:0
#13 0x00005bd93df94554 computeKnownFPClass(llvm::Value const*, llvm::APInt const&, llvm::FPClassTest, llvm::KnownFPClass&, llvm::SimplifyQuery const&, unsigned int) (.part.0) ValueTracking.cpp:0:0
#14 0x00005bd93df97e81 llvm::computeKnownFPClass(llvm::Value const*, llvm::APInt const&, llvm::FPClassTest, llvm::SimplifyQuery const&, unsigned int) (/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/bin/clang-22+0x1bdee81)
#15 0x00005bd93ebcc610 llvm::InstCombinerImpl::SimplifyDemandedUseFPClass(llvm::Value*, llvm::APInt const&, llvm::FPClassTest, llvm::KnownFPClass&, llvm::Instruction*, unsigned int) (/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/bin/clang-22+0x2813610)
#16 0x00005bd93ebcc182 llvm::InstCombinerImpl::SimplifyDemandedFPClass(llvm::Instruction*, unsigned int, llvm::APInt const&, llvm::FPClassTest, llvm::KnownFPClass&, unsigned int) (/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/bin/clang-22+0x2813182)
#17 0x00005bd93ebcc67c llvm::InstCombinerImpl::SimplifyDemandedUseFPClass(llvm::Value*, llvm::APInt const&, llvm::FPClassTest, llvm::KnownFPClass&, llvm::Instruction*, unsigned int) (/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/bin/clang-22+0x281367c)
#18 0x00005bd93ebcd5b1 llvm::InstCombinerImpl::SimplifyDemandedUseFPClass(llvm::Value*, llvm::FPClassTest, llvm::KnownFPClass&, llvm::Instruction*, unsigned int) (/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/bin/clang-22+0x28145b1)
#19 0x00005bd93ea95d8d llvm::InstCombinerImpl::visitReturnInst(llvm::ReturnInst&) (/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/bin/clang-22+0x26dcd8d)
#20 0x00005bd93eaa4745 llvm::InstCombinerImpl::run() (/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/bin/clang-22+0x26eb745)
#21 0x00005bd93eaa6645 combineInstructionsOverFunction(llvm::Function&, llvm::InstructionWorklist&, llvm::AAResults*, llvm::AssumptionCache&, llvm::TargetLibraryInfo&, llvm::TargetTransformInfo&, llvm::DominatorTree&, llvm::OptimizationRemarkEmitter&, llvm::BlockFrequencyInfo*, llvm::BranchProbabilityInfo*, llvm::ProfileSummaryInfo*, llvm::InstCombineOptions const&) InstructionCombining.cpp:0:0
#22 0x00005bd93eaa7b82 llvm::InstCombinePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/bin/clang-22+0x26eeb82)
#23 0x00005bd93f243de6 llvm::detail::PassModel<llvm::Function, llvm::InstCombinePass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/bin/clang-22+0x2e8ade6)
#24 0x00005bd93e8c0cf2 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/bin/clang-22+0x2507cf2)
#25 0x00005bd93d0d19b6 llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/bin/clang-22+0xd189b6)
#26 0x00005bd93e8bed09 llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/bin/clang-22+0x2505d09)
#27 0x00005bd93d0d2056 llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/bin/clang-22+0xd19056)
#28 0x00005bd93e8bfa55 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/bin/clang-22+0x2506a55)
#29 0x00005bd93f253fc2 (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
#30 0x00005bd93f257b19 clang::emitBackendOutput(clang::CompilerInstance&, clang::CodeGenOptions&, 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*) (/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/bin/clang-22+0x2e9eb19)
#31 0x00005bd93f8fb192 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/bin/clang-22+0x3542192)
#32 0x00005bd941454a8c clang::ParseAST(clang::Sema&, bool, bool) (/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/bin/clang-22+0x509ba8c)
#33 0x00005bd93fc34749 clang::FrontendAction::Execute() (/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/bin/clang-22+0x387b749)
#34 0x00005bd93fbb2fe5 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/bin/clang-22+0x37f9fe5)
#35 0x00005bd93fd2c713 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/bin/clang-22+0x3973713)
#36 0x00005bd93d091950 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/bin/clang-22+0xcd8950)
#37 0x00005bd93d087f7a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>) driver.cpp:0:0
#38 0x00005bd93d08c268 clang_main(int, char**, llvm::ToolContext const&) (/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/bin/clang-22+0xcd3268)
#39 0x00005bd93cf99e9b main (/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/bin/clang-22+0xbe0e9b)
#40 0x00007190aec07d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#41 0x00007190aec07e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#42 0x00005bd93d087695 _start (/home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/bin/clang-22+0xcce695)
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 22.0.0git (https://github.com/llvm/llvm-project.git e2ee738b6d8441f9fcdd31004fa99035c4c95714)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/botworker/bbot/clang-hip-vega20/botworker/clang-hip-vega20/llvm/bin
```


https://github.com/llvm/llvm-project/pull/174176


More information about the llvm-commits mailing list