HomePhabricator

[InstCombine] Expand the simplification of log()

Description

[InstCombine] Expand the simplification of log()

Expand the simplification of special cases of log() to include log2()
and log10() as well as intrinsics and more types.

Differential revision: https://reviews.llvm.org/D67199

Details

Event Timeline

Hi Evandro,

I ran this commit on SPEC CPU2017 520.omnetpp_r with option "-Ofast -funroll-loops -flto -mfpmath=sse -march=core-avx2", following error came out:

Stack dump:
1.      <eof> parser at end of file
2.      Per-module optimization passes
3.      Running pass 'CallGraph Pass Manager' on module 'simulator/distrib.cc'.
4.      Running pass 'Combine redundant instructions' on function '@_Z11exponentialdi'
 #0 0x00002b1e5903c7ba llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/export/users/yidizhou/20190930_205221/deploy/linux_prod/bin/../lib/libLLVM-10svn.so+0x6bf7ba)
 #1 0x00002b1e5903a81a llvm::sys::RunSignalHandlers() (/export/users/yidizhou/20190930_205221/deploy/linux_prod/bin/../lib/libLLVM-10svn.so+0x6bd81a)
 #2 0x00002b1e5903a949 SignalHandler(int) (/export/users/yidizhou/20190930_205221/deploy/linux_prod/bin/../lib/libLLVM-10svn.so+0x6bd949)
 #3 0x00002b1e5b5fe5e0 __restore_rt (/lib64/libpthread.so.0+0xf5e0)
 #4 0x00002b1e5918fde0 llvm::Value::getName() const (/export/users/yidizhou/20190930_205221/deploy/linux_prod/bin/../lib/libLLVM-10svn.so+0x812de0)
 #6 0x00002b1e59a48c4b llvm::LibCallSimplifier::optimizeCall(llvm::CallInst*) (/export/users/yidizhou/20190930_205221/deploy/linux_prod/bin/../lib/libLLVM-10svn.so+0x10cbc4b)
 #7 0x00002b1e59b4eef7 llvm::InstCombiner::tryOptimizeCall(llvm::CallInst*) (/export/users/yidizhou/20190930_205221/deploy/linux_prod/bin/../lib/libLLVM-10svn.so+0x11d1ef7)
 #8 0x00002b1e59b5662b llvm::InstCombiner::visitCallBase(llvm::CallBase&) (/export/users/yidizhou/20190930_205221/deploy/linux_prod/bin/../lib/libLLVM-10svn.so+0x11d962b)
 #9 0x00002b1e59b57899 llvm::InstCombiner::visitCallInst(llvm::CallInst&) (/export/users/yidizhou/20190930_205221/deploy/linux_prod/bin/../lib/libLLVM-10svn.so+0x11da899)
#10 0x00002b1e59b23969 llvm::InstCombiner::run() (/export/users/yidizhou/20190930_205221/deploy/linux_prod/bin/../lib/libLLVM-10svn.so+0x11a6969)
#11 0x00002b1e59b248cb combineInstructionsOverFunction(llvm::Function&, llvm::InstCombineWorklist&, llvm::AAResults*, llvm::AssumptionCache&, llvm::TargetLibraryInfo&, llvm::DominatorTree&, llvm::OptimizationRemarkEmitter&, llvm::BlockFrequencyInfo*, llvm::ProfileSummaryInfo*, bool, llvm::LoopInfo*) (/export/users/yidizhou/20190930_205221/deploy/linux_prod/bin/../lib/libLLVM-10svn.so+0x11a78cb)
#12 0x00002b1e59b250a2 llvm::InstructionCombiningPass::runOnFunction(llvm::Function&) (/export/users/yidizhou/20190930_205221/deploy/linux_prod/bin/../lib/libLLVM-10svn.so+0x11a80a2)
#13 0x00002b1e5913937f llvm::FPPassManager::runOnFunction(llvm::Function&) (/export/users/yidizhou/20190930_205221/deploy/linux_prod/bin/../lib/libLLVM-10svn.so+0x7bc37f)
#14 0x00002b1e5a0356f7 (anonymous namespace)::CGPassManager::runOnModule(llvm::Module&) (/export/users/yidizhou/20190930_205221/deploy/linux_prod/bin/../lib/libLLVM-10svn.so+0x16b86f7)
#15 0x00002b1e5913a27b llvm::legacy::PassManagerImpl::run(llvm::Module&) (/export/users/yidizhou/20190930_205221/deploy/linux_prod/bin/../lib/libLLVM-10svn.so+0x7bd27b)
#16 0x00002b1e5ca116c3 (anonymous namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >) (/export/users/yidizhou/20190930_205221/deploy/linux_prod/bin/../lib/libclang-cpp.so.10svn+0x12066c3)
#17 0x00002b1e5ca13048 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >) (/export/users/yidizhou/20190930_205221/deploy/linux_prod/bin/../lib/libclang-cpp.so.10svn+0x1208048)
#18 0x00002b1e5cc5c58b clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/export/users/yidizhou/20190930_205221/deploy/linux_prod/bin/../lib/libclang-cpp.so.10svn+0x145158b)
#19 0x00002b1e5bf575d9 clang::ParseAST(clang::Sema&, bool, bool) (/export/users/yidizhou/20190930_205221/deploy/linux_prod/bin/../lib/libclang-cpp.so.10svn+0x74c5d9)
#20 0x00002b1e5cc5a1fc clang::CodeGenAction::ExecuteAction() (/export/users/yidizhou/20190930_205221/deploy/linux_prod/bin/../lib/libclang-cpp.so.10svn+0x144f1fc)
#21 0x00002b1e5d251079 clang::FrontendAction::Execute() (/export/users/yidizhou/20190930_205221/deploy/linux_prod/bin/../lib/libclang-cpp.so.10svn+0x1a46079)
#22 0x00002b1e5d20f258 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/export/users/yidizhou/20190930_205221/deploy/linux_prod/bin/../lib/libclang-cpp.so.10svn+0x1a04258)
#23 0x00002b1e5d2c656a clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/export/users/yidizhou/20190930_205221/deploy/linux_prod/bin/../lib/libclang-cpp.so.10svn+0x1abb56a)
#24 0x0000000000412691 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/export/users/yidizhou/20190930_205221/deploy/linux_prod/bin/clang-10+0x412691)
#25 0x000000000040e186 main (/export/users/yidizhou/20190930_205221/deploy/linux_prod/bin/clang-10+0x40e186)
#26 0x00002b1e5e992c05 __libc_start_main (/lib64/libc.so.6+0x21c05)
#27 0x000000000040ff3e _start (/export/users/yidizhou/20190930_205221/deploy/linux_prod/bin/clang-10+0x40ff3e)
clang-10: error: unable to execute command: Segmentation fault (core dumped)
clang-10: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 10.0.0 (/export/users/yidizhou/20190930_205221/llvm/clang 110b1138baf4b0736cd65c5fa4b3b697c318a6da)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /export/users/yidizhou/20190930_205221/deploy/linux_prod/bin

Do you have any idea about this issue?

Thanks!