[llvm-bugs] [Bug 31672] Assertion failed: ((TLI.getTypeAction(*DAG.getContext(), Op.getValueType()) == TargetLowering::TypeLegal || TLI.isTypeLegal(Op.getValueType()) || Op.getOpcode() == ISD::TargetC

2017-01-22 Thread via llvm-bugs
https://llvm.org/bugs/show_bug.cgi?id=31672

Sanjay Patel  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #6 from Sanjay Patel  ---
Should be fixed with:
https://reviews.llvm.org/rL292758

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs


[llvm-bugs] [Bug 31718] New: clang crashes on valid code at -O2 on x86_64-linux-gnu while running pass 'Induction Variable Simplification': Assertion `L->isRecursivelyLCSSAForm(*DT, *LI) && "LCSSA req

2017-01-22 Thread via llvm-bugs
https://llvm.org/bugs/show_bug.cgi?id=31718

Bug ID: 31718
   Summary: clang crashes on valid code at -O2 on x86_64-linux-gnu
while running pass 'Induction Variable
Simplification': Assertion
`L->isRecursivelyLCSSAForm(*DT, *LI) && "LCSSA
required to run indvars!"' failed
   Product: clang
   Version: unspecified
  Hardware: PC
OS: All
Status: NEW
  Severity: normal
  Priority: P
 Component: -New Bugs
  Assignee: unassignedclangb...@nondot.org
  Reporter: s...@cs.ucdavis.edu
CC: llvm-bugs@lists.llvm.org
Classification: Unclassified

$ clang -v
clang version 5.0.0 (trunk 292714)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.0.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$
$ clang -Os small.c
$
$ clang -O2 small.c
clang-5.0:
/tmp/llvm-builder/llvm-source-trunk/lib/Transforms/Scalar/IndVarSimplify.cpp:2369:
bool {anonymous}::IndVarSimplify::run(llvm::Loop*): Assertion
`L->isRecursivelyLCSSAForm(*DT, *LI) && "LCSSA required to run indvars!"'
failed.
#0 0x01e1a2d8 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-5.0+0x1e1a2d8)
#1 0x01e17f6e llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-5.0+0x1e17f6e)
#2 0x01e180e2 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-5.0+0x1e180e2)
#3 0x7f45a22a5390 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
#4 0x7f45a1018428 gsignal
/build/glibc-t3gR2i/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
#5 0x7f45a101a02a abort /build/glibc-t3gR2i/glibc-2.23/stdlib/abort.c:91:0
#6 0x7f45a1010bd7 __assert_fail_base
/build/glibc-t3gR2i/glibc-2.23/assert/assert.c:92:0
#7 0x7f45a1010c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
#8 0x01c8447b (anonymous
namespace)::IndVarSimplifyLegacyPass::runOnLoop(llvm::Loop*,
llvm::LPPassManager&) [clone .part.440] [clone .constprop.452]
(/usr/local/clang-trunk/bin/clang-5.0+0x1c8447b)
#9 0x0281930b llvm::LPPassManager::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-5.0+0x281930b)
#10 0x019f3173 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-5.0+0x19f3173)
#11 0x027dbbcf (anonymous
namespace)::CGPassManager::runOnModule(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-5.0+0x27dbbcf)
#12 0x019f2cdd llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-5.0+0x19f2cdd)
#13 0x01fbc8c2 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 >)
(/usr/local/clang-trunk/bin/clang-5.0+0x1fbc8c2)
#14 0x02625d00
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/usr/local/clang-trunk/bin/clang-5.0+0x2625d00)
#15 0x02a0d4d8 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-5.0+0x2a0d4d8)
#16 0x02620739 clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-5.0+0x2620739)
#17 0x02317f16 clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-5.0+0x2317f16)
#18 0x022ea856
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-5.0+0x22ea856)
#19 0x0239f63a
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-5.0+0x239f63a)
#20 0x00a49ac8 cc1_main(llvm::ArrayRef, char const*,
void*) (/usr/local/clang-trunk/bin/clang-5.0+0xa49ac8)
#21 0x009dbd9c main (/usr/local/clang-trunk/bin/clang-5.0+

[llvm-bugs] [Bug 31719] New: LLVM maintain useless state when using adc

2017-01-22 Thread via llvm-bugs
https://llvm.org/bugs/show_bug.cgi?id=31719

Bug ID: 31719
   Summary: LLVM maintain useless state when using adc
   Product: libraries
   Version: trunk
  Hardware: PC
OS: Windows NT
Status: NEW
  Severity: normal
  Priority: P
 Component: Backend: X86
  Assignee: unassignedb...@nondot.org
  Reporter: deadal...@gmail.com
CC: llvm-bugs@lists.llvm.org
Classification: Unclassified

Sample IR (optimized):

; Function Attrs: norecurse nounwind readonly
define %scalar @foo(%scalar* nocapture readonly %this, %scalar %arg.b)
local_unnamed_addr #1 {
entry:
  %0 = extractvalue %scalar %arg.b, 0
  %.elt = extractvalue [4 x i64] %0, 0
  %.elt24 = extractvalue [4 x i64] %0, 1
  %.elt26 = extractvalue [4 x i64] %0, 2
  %.elt28 = extractvalue [4 x i64] %0, 3
  %1 = getelementptr inbounds %scalar , %scalar* %this, i64 0, i32 0, i64 0
  %2 = load i64, i64* %1, align 8
  %3 = zext i64 %2 to i128
  %4 = zext i64 %.elt to i128
  %5 = add nuw nsw i128 %3, %4
  %6 = trunc i128 %5 to i64
  %7 = lshr i128 %5, 64
  %8 = getelementptr inbounds %scalar , %scalar * %this, i64 0, i32 0, i64 1
  %9 = load i64, i64* %8, align 8
  %10 = zext i64 %9 to i128
  %11 = zext i64 %.elt24 to i128
  %12 = add nuw nsw i128 %10, %11
  %13 = add nuw nsw i128 %12, %7
  %14 = trunc i128 %13 to i64
  %15 = lshr i128 %13, 64
  %16 = getelementptr inbounds %scalar , %scalar* %this, i64 0, i32 0, i64 2
  %17 = load i64, i64* %16, align 8
  %18 = zext i64 %17 to i128
  %19 = zext i64 %.elt26 to i128
  %20 = add nuw nsw i128 %18, %19
  %21 = add nuw nsw i128 %20, %15
  %22 = trunc i128 %21 to i64
  %23 = lshr i128 %21, 64
  %24 = getelementptr inbounds %scalar , %scalar* %this, i64 0, i32 0, i64 3
  %25 = load i64, i64* %24, align 8
  %26 = zext i64 %25 to i128
  %27 = zext i64 %.elt28 to i128
  %28 = add nuw nsw i128 %26, %27
  %29 = add nuw nsw i128 %28, %23
  %30 = trunc i128 %29 to i64
  %31 = insertvalue [4 x i64] undef, i64 %6, 0
  %32 = insertvalue [4 x i64] %31, i64 %14, 1
  %33 = insertvalue [4 x i64] %32, i64 %22, 2
  %34 = insertvalue [4 x i64] %33, i64 %30, 3
  %35 = insertvalue %S6crypto5field6Scalar undef, [4 x i64] %34, 0
  ret %scalar%35
}

attributes #0 = { norecurse nounwind readnone }
attributes #1 = { norecurse nounwind readonly }

Codegen:

foo:
addq(%rsi), %rdx
sbbq%r10, %r10
andl$1, %r10d
addq8(%rsi), %rcx
sbbq%r11, %r11
andl$1, %r11d
addq%r10, %rcx
adcq$0, %r11
addq16(%rsi), %r8
sbbq%rax, %rax
andl$1, %eax
addq%r11, %r8
adcq$0, %rax
addq24(%rsi), %r9
addq%rax, %r9
movq%rdx, (%rdi)
movq%rcx, 8(%rdi)
movq%r8, 16(%rdi)
movq%r9, 24(%rdi)
movq%rdi, %rax
retq

While LLVM is able to leverage the use of the adc instruction (good) it is
unclear why it is doing so in RAX and then adding RAX rather than using ADC
right away. See for instance:

adcq$0, %rax
addq24(%rsi), %r9
addq%rax, %r9

Uses adc to store the carry in RAX and then perform 2 additions, when it could
simply do

adcq24(%rsi), %r9

These routine are at the core of various crypto libraries and need to be fast.
Any chance to get better codegen here ?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs