LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 41749 - In function: __mulxc3 Cannot select: 0x55d58830cbf0: f80 = ConstantFP<APFloat(604462909807314587353088)>
Summary: In function: __mulxc3 Cannot select: 0x55d58830cbf0: f80 = ConstantFP<APFloat...
Status: NEW
Alias: None
Product: libraries
Classification: Unclassified
Component: Backend: X86 (show other bugs)
Version: 8.0
Hardware: PC Linux
: P enhancement
Assignee: Unassigned LLVM Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-05-05 05:09 PDT by Constantin Runge
Modified: 2019-05-05 11:59 PDT (History)
5 users (show)

See Also:
Fixed By Commit(s):


Attachments
bugpoint-reduced-simplified.bc (1.41 KB, application/octet-stream)
2019-05-05 05:09 PDT, Constantin Runge
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Constantin Runge 2019-05-05 05:09:43 PDT
Created attachment 21896 [details]
bugpoint-reduced-simplified.bc

Clang 7 as well as Clang 8 ran into errors while compiling the respective compiler-rt.

Tracing the bug led me to a crashing llc:


    > llc -asm-show-inst -asm-verbose bugpoint-reduced-simplified.bc
    LLVM ERROR: Cannot select: 0x55d58830cbf0: f80 = ConstantFP<APFloat(604462909807314587353088)>
    In function: __mulxc3

The .bc file is attached.
Comment 1 Simon Pilgrim 2019-05-05 05:13:28 PDT
; ModuleID = 'bugpoint-reduced-simplified.bc'
source_filename = "mulxc3-1a6977-min.i"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"

define dso_local void @__mulxc3() #0 {
  %1 = call x86_fp80 @llvm.copysign.f80(x86_fp80 0xK00000000000000000000, x86_fp80 undef)
  store x86_fp80 %1, x86_fp80* undef, align 16
  ret void
}

; Function Attrs: nounwind readnone speculatable
declare x86_fp80 @llvm.copysign.f80(x86_fp80, x86_fp80) #1

attributes #0 = { "use-soft-float"="false" }
attributes #1 = { nounwind readnone speculatable }

!llvm.ident = !{!0}

!0 = !{!"clang version 8.0.0 (tags/RELEASE_800/final)"}
Comment 2 Craig Topper 2019-05-05 11:01:28 PDT
I'm not able to reproduce this. I've tried trunk and building from the 8.0 source. 

This is the pattern in X86InstrFPStack.td that this should correspond to
def : Pat<(f80 fpimmneg0), (CHS_Fp80 (LD_Fp080))>;

This line hasn't been edited in years.

Simon, did you reproduce this or just disassemble the bugpoint bitcode?
Comment 3 Simon Pilgrim 2019-05-05 11:12:56 PDT
(In reply to Craig Topper from comment #2)
> Simon, did you reproduce this or just disassemble the bugpoint bitcode?

I just dissembled it - I can't repro it either (from the bc or the ir) but I forgot to mention that when I pasted the IR.

Constantin - please can you give us some more context to your build?
Comment 4 Constantin Runge 2019-05-05 11:17:13 PDT
> Constantin - please can you give us some more context to your build?

Hmm.. Not sure what you need/what helps you. It's a Gentoo Linux machine with a Haswell CPU.

I can see if playing around with some optimization flags during clang/llvm build changes the behavior.
Comment 5 Constantin Runge 2019-05-05 11:59:55 PDT
Ok, compiling llvm and clang with

    CFLAGS="-pipe -march=native -O2"
    CXXFLAGS="${CFLAGS}"
    LDFLAGS="-Wl,-O1 -Wl,--as-needed"

works (ie is not reproducible). Whereas with

    CFLAGS="-pipe -march=native -O3 -fomit-frame-pointer -fstack-protector-strong -ftree-vectorize -fassociative-math -fno-signed-zeros -fno-trapping-math -freciprocal-math -floop-parallelize-all -fgraphite-identity -floop-nest-optimize -flto=8"
    CXXFLAGS="-pipe -march=native -O3 -fomit-frame-pointer -fstack-protector-strong -ftree-vectorize -fassociative-math -fno-signed-zeros -fno-trapping-math -freciprocal-math -floop-parallelize-all -fgraphite-identity -floop-nest-optimize -flto=8 -fvisibility-inlines-hidden"
    LDFLAGS="-pipe -march=native -O3 -fomit-frame-pointer -fstack-protector-strong -ftree-vectorize -fassociative-math -fno-signed-zeros -fno-trapping-math -freciprocal-math -floop-parallelize-all -fgraphite-identity -floop-nest-optimize -flto=8 -Wl,-O1,--as-needed,--hash-style=gnu,--sort-common,-z,relro,-z,now"

I get the bug.

Probably I can isolate the flag.