Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
LGTM. I think it makes sense for the same reason as the zext case.
lib/Transforms/InstCombine/InstCombineAndOrXor.cpp | ||
---|---|---|
1092 ↗ | (On Diff #109381) | Update comment to 'zext or sext'. |
test/Transforms/InstCombine/cast.ll | ||
591–592 ↗ | (On Diff #109381) | Not this patch, but seems odd that we'd choose to sext to the larger type and mask rather than sext+zext? |
Comment Actions
Hi,
This patch causes an assertion failure on the attached test.ll. Could you please have a look at it?
$ ../bin/opt test.ll -instcombine -S opt: ../lib/IR/Constants.cpp:1551: static llvm::Constant* llvm::ConstantExpr::getTrunc(llvm::Constant*, llvm::Type*, bool): Assertion `C->getType()->getScalarSizeInBits() > Ty->getScalarSizeInBits()&& "SrcTy must be larger than DestTy for Trunc!"' failed. #0 0x000000000360ab38 llvm::sys::PrintStackTrace(llvm::raw_ostream&) /home/evgast01/local/repos/llvm12/build.d/../lib/Support/Unix/Signals.inc:398:0 #1 0x000000000360abc9 PrintStackTraceSignalHandler(void*) /home/evgast01/local/repos/llvm12/build.d/../lib/Support/Unix/Signals.inc:462:0 #2 0x0000000003608fde llvm::sys::RunSignalHandlers() /home/evgast01/local/repos/llvm12/build.d/../lib/Support/Signals.cpp:49:0 #3 0x000000000360a4bb SignalHandler(int) /home/evgast01/local/repos/llvm12/build.d/../lib/Support/Unix/Signals.inc:252:0 #4 0x00007f37c51e1330 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x10330) #5 0x00007f37c3fc9c37 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x36c37) #6 0x00007f37c3fcd028 abort (/lib/x86_64-linux-gnu/libc.so.6+0x3a028) #7 0x00007f37c3fc2bf6 (/lib/x86_64-linux-gnu/libc.so.6+0x2fbf6) #8 0x00007f37c3fc2ca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2) #9 0x0000000002e19bc5 llvm::ConstantExpr::getTrunc(llvm::Constant*, llvm::Type*, bool) /home/evgast01/local/repos/llvm12/build.d/../lib/IR/Constants.cpp:1553:0 #10 0x0000000003103c73 getSelectCondition(llvm::Value*, llvm::Value*, llvm::IRBuilder<llvm::TargetFolder, llvm::IRBuilderCallbackInserter>&) /home/evgast01/local/repos/llvm12/build.d/../lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:1498:0 #11 0x0000000003103f10 matchSelectFromAndOr(llvm::Value*, llvm::Value*, llvm::Value*, llvm::Value*, llvm::IRBuilder<llvm::TargetFolder, llvm::IRBuilderCallbackInserter>&) /home/evgast01/local/repos/llvm12/build.d/../lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:1522:0 #12 0x00000000031071fe llvm::InstCombiner::visitOr(llvm::BinaryOperator&) /home/evgast01/local/repos/llvm12/build.d/../lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:1989:0 #13 0x00000000030e9dbb llvm::InstVisitor<llvm::InstCombiner, llvm::Instruction*>::visit(llvm::Instruction&) /home/evgast01/local/repos/llvm12/build.d/../include/llvm/IR/Instruction.def:146:0 #14 0x00000000030e48a5 llvm::InstCombiner::run() /home/evgast01/local/repos/llvm12/build.d/../lib/Transforms/InstCombine/InstructionCombining.cpp:2971:0 #15 0x00000000030e5a86 combineInstructionsOverFunction(llvm::Function&, llvm::InstCombineWorklist&, llvm::AAResults*, llvm::AssumptionCache&, llvm::TargetLibraryInfo&, llvm::DominatorTree&, llvm::OptimizationRemarkEmitter&, bool, llvm::LoopInfo*) /home/evgast01/local/repos/llvm12/build.d/../lib/Transforms/InstCombine/InstructionCombining.cpp:3203:0 #16 0x00000000030e5e0f llvm::InstructionCombiningPass::runOnFunction(llvm::Function&) /home/evgast01/local/repos/llvm12/build.d/../lib/Transforms/InstCombine/InstructionCombining.cpp:3262:0 #17 0x0000000002f14f46 llvm::FPPassManager::runOnFunction(llvm::Function&) /home/evgast01/local/repos/llvm12/build.d/../lib/IR/LegacyPassManager.cpp:1514:0 #18 0x0000000002f150d9 llvm::FPPassManager::runOnModule(llvm::Module&) /home/evgast01/local/repos/llvm12/build.d/../lib/IR/LegacyPassManager.cpp:1535:0 #19 0x0000000002f15474 (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) /home/evgast01/local/repos/llvm12/build.d/../lib/IR/LegacyPassManager.cpp:1591:0 #20 0x0000000002f15bcb llvm::legacy::PassManagerImpl::run(llvm::Module&) /home/evgast01/local/repos/llvm12/build.d/../lib/IR/LegacyPassManager.cpp:1694:0 #21 0x0000000002f15e0b llvm::legacy::PassManager::run(llvm::Module&) /home/evgast01/local/repos/llvm12/build.d/../lib/IR/LegacyPassManager.cpp:1726:0 #22 0x00000000015ee1ae main /home/evgast01/local/repos/llvm12/build.d/../tools/opt/opt.cpp:759:0 #23 0x00007f37c3fb4f45 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21f45) #24 0x00000000015c7f89 _start (../bin/opt+0x15c7f89) Stack dump: 0. Program arguments: ../bin/opt test.ll -instcombine -S 1. Running pass 'Function Pass Manager' on module 'test.ll'. 2. Running pass 'Combine redundant instructions' on function '@dotests_115' Aborted
Comment Actions
Fixed the assertion failure in r310639. Looks like a latent bug that was always there. I added a reduced test case with the commit that doesn't rely on any sext folding.