Renato Golin | 1 Oct 2010 01:13
Favicon

Re: ARM/MC/ELF questions on .ARM.attributes section

On 30 September 2010 22:50, Jason Kim <jasonwkim <at> google.com> wrote:
> 3. For the existing GNU ARM toolchain, what are the supported blobs
> that go into the ARM specific sections in the ELF file? (Renato, could
> you possibly shed light on  this?) I'd like to figure this out before
> I attempt to fill out ARM-specific changes to the MCELFStreamer

Hi Jason,

>From our tests, GCC doesn't understand most of them. I haven't dig up
the source code, but we tried to pass them in different combinations
and everything gets overwritten but what GCC thinks it's right. So
far, everything but cpu and fpu gets overwritten, and the instruction
set is defined by the instructions in the assembly code, rather than
by its build attribute.

I think GCC does it mostly for compatibility, as it getting it wrong
is worse than ignoring it completely. But build attributes were not
designed to describe the standard configuration of an architecture,
but to change it according to user's necessities.

It would be great if we can get them right in LLVM, but there are
catches. We need to let the options available to all passes. The code
generation / instruction selection phases have to be in sync with all
the implications of the selected attribute, or the linking process
could blow up. Also, we need to get the possible combinations right
and show errors/warnings to the user when they get them wrong. I don't
have any case on the top of my head that could blow up but I will see
if there is any public document we can create the list of combinations
from.

(Continue reading)

Samuel Williams | 1 Oct 2010 02:43
Picon

Re: CMake "sudo make install" & headers

Hi,

I did this:

$ cmake -DCMAKE_INSTALL_PREFIX=~/llvm-2.8 -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=X86 ..
$ make
$ make install

Still didn't install the headers.

$ cd ~/llvm-2.8/include/
$ ls -la
total 0
drwxr-xr-x  2 samuel  staff   68  1 Oct 12:47 .
drwxr-xr-x  6 samuel  staff  204  1 Oct 12:47 ..

Libraries and binaries installed fine:

$ cd ../lib/
$ ls -la
total 44600
drwxr-xr-x  2 samuel  staff     1190  1 Oct 13:40 .
drwxr-xr-x  6 samuel  staff      204  1 Oct 12:47 ..
-rwxr-xr-x  1 samuel  staff    17736  1 Oct 13:40 BugpointPasses.so
-rwxr-xr-x  1 samuel  staff    17304  1 Oct 13:36 LLVMHello.so
-rw-r--r--  1 samuel  staff    11592  1 Oct 13:40 libEnhancedDisassembly.a
-rw-r--r--  1 samuel  staff  2229616  1 Oct 13:40 libLLVMAnalysis.a
-rw-r--r--  1 samuel  staff    80080  1 Oct 13:40 libLLVMArchive.a
-rw-r--r--  1 samuel  staff   375672  1 Oct 13:40 libLLVMAsmParser.a
-rw-r--r--  1 samuel  staff   417544  1 Oct 13:40 libLLVMAsmPrinter.a
-rw-r--r--  1 samuel  staff   195016  1 Oct 13:40 libLLVMBitReader.a
-rw-r--r--  1 samuel  staff   170536  1 Oct 13:40 libLLVMBitWriter.a
-rw-r--r--  1 samuel  staff  3275696  1 Oct 13:40 libLLVMCodeGen.a
-rw-r--r--  1 samuel  staff  2523744  1 Oct 13:40 libLLVMCore.a
-rw-r--r--  1 samuel  staff   134504  1 Oct 13:40 libLLVMExecutionEngine.a
-rw-r--r--  1 samuel  staff   926488  1 Oct 13:40 libLLVMInstCombine.a
* snip *

Could there be some additional option required for development files? Currently, I have CMAKE_BUILD_TYPE=Release - maybe this doesn't install headers?

Kind regards,
Samuel

On 1/10/2010, at 11:52 AM, Óscar Fuentes wrote:

The following message is a courtesy copy of an article
that has been posted to gmane.comp.compilers.llvm.devel as well.

Samuel Williams <space.ship.traveller <at> gmail.com> writes:

[snip]

The problem is that exactly the same arguments to CMake on Mac OS X
and Linux give different results.

On Mac OS X, headers are not installed. On Linux, they are
installed. I've tested this on Debian Linux and OS X 10.6.4 both with
CMake >= 2.8.0

I am not sure how to debug this problem. Does anyone have any
experience with CMake command line on Mac OS X?

It should work the same, regardless of what interface you use for
configuring. Else, it would be a strong indication of a bug on cmake.

The commands for installing the headers are at the end of the top-level
CMakeLists.txt.

Try building and installing without `sudo', i.e. under your home
directory. Whatever result you get will be useful to know.

_______________________________________________
LLVM Developers mailing list
LLVMdev <at> cs.uiuc.edu         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Samuel Williams | 1 Oct 2010 03:07
Picon

Re: CMake "sudo make install" & headers

If that was a problem, wouldn't it affect the installation of every other type of file? Also, wouldn't that be a really strange bug?

Anyway, I checked and the path was expanded, probably by the shell:

-- Install configuration: "Release"
-- Installing: /Users/samuel/llvm-2.8/lib/libLLVMSupport.a
-- Installing: /Users/samuel/llvm-2.8/lib/libLLVMSystem.a
-- Installing: /Users/samuel/llvm-2.8/lib/libLLVMCore.a
-- Installing: /Users/samuel/llvm-2.8/lib/libLLVMCodeGen.a

Still no solution.

Kind regards,
Samuel

On 1/10/2010, at 2:02 PM, Florian Sauer wrote:

Is it the use of ~ ?



On Sep 30, 2010, at 17:46, Samuel Williams <space.ship.traveller <at> gmail.com> wrote:

Hi,

I did this:

$ cmake -DCMAKE_INSTALL_PREFIX=~/llvm-2.8 -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=X86 ..
$ make
$ make install

Still didn't install the headers.

$ cd ~/llvm-2.8/include/
$ ls -la
total 0
drwxr-xr-x  2 samuel  staff   68  1 Oct 12:47 .
drwxr-xr-x  6 samuel  staff  204  1 Oct 12:47 ..

Libraries and binaries installed fine:

$ cd ../lib/
$ ls -la
total 44600
drwxr-xr-x  2 samuel  staff     1190  1 Oct 13:40 .
drwxr-xr-x  6 samuel  staff      204  1 Oct 12:47 ..
-rwxr-xr-x  1 samuel  staff    17736  1 Oct 13:40 BugpointPasses.so
-rwxr-xr-x  1 samuel  staff    17304  1 Oct 13:36 LLVMHello.so
-rw-r--r--  1 samuel  staff    11592  1 Oct 13:40 libEnhancedDisassembly.a
-rw-r--r--  1 samuel  staff  2229616  1 Oct 13:40 libLLVMAnalysis.a
-rw-r--r--  1 samuel  staff    80080  1 Oct 13:40 libLLVMArchive.a
-rw-r--r--  1 samuel  staff   375672  1 Oct 13:40 libLLVMAsmParser.a
-rw-r--r--  1 samuel  staff   417544  1 Oct 13:40 libLLVMAsmPrinter.a
-rw-r--r--  1 samuel  staff   195016  1 Oct 13:40 libLLVMBitReader.a
-rw-r--r--  1 samuel  staff   170536  1 Oct 13:40 libLLVMBitWriter.a
-rw-r--r--  1 samuel  staff  3275696  1 Oct 13:40 libLLVMCodeGen.a
-rw-r--r--  1 samuel  staff  2523744  1 Oct 13:40 libLLVMCore.a
-rw-r--r--  1 samuel  staff   134504  1 Oct 13:40 libLLVMExecutionEngine.a
-rw-r--r--  1 samuel  staff   926488  1 Oct 13:40 libLLVMInstCombine.a
* snip *

Could there be some additional option required for development files? Currently, I have CMAKE_BUILD_TYPE=Release - maybe this doesn't install headers?

Kind regards,
Samuel

On 1/10/2010, at 11:52 AM, Óscar Fuentes wrote:

The following message is a courtesy copy of an article
that has been posted to gmane.comp.compilers.llvm.devel as well.

Samuel Williams <space.ship.traveller <at> gmail.com> writes:

[snip]

The problem is that exactly the same arguments to CMake on Mac OS X
and Linux give different results.

On Mac OS X, headers are not installed. On Linux, they are
installed. I've tested this on Debian Linux and OS X 10.6.4 both with
CMake >= 2.8.0

I am not sure how to debug this problem. Does anyone have any
experience with CMake command line on Mac OS X?

It should work the same, regardless of what interface you use for
configuring. Else, it would be a strong indication of a bug on cmake.

The commands for installing the headers are at the end of the top-level
CMakeLists.txt.

Try building and installing without `sudo', i.e. under your home
directory. Whatever result you get will be useful to know.

_______________________________________________
LLVM Developers mailing list
LLVMdev <at> cs.uiuc.edu         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

_______________________________________________
LLVM Developers mailing list
LLVMdev <at> cs.uiuc.edu         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Óscar Fuentes | 1 Oct 2010 04:02
Picon

Re: CMake "sudo make install" & headers

Samuel Williams <space.ship.traveller <at> gmail.com> writes:

[snip]

> Could there be some additional option required for development files?
> Currently, I have CMAKE_BUILD_TYPE=Release - maybe this doesn't
> install headers?

`make install' installs everything, always, no options required.
Samuel Williams | 1 Oct 2010 04:09
Picon

Re: CMake "sudo make install" & headers

Dear Oscar,

Thanks for the clarification - thats what I expected, and that is how it works on my Linux computer.

However, I am still having problems on Mac OS X with headers not being installed.

Is the person who put together the CMake build files available to diagnose the problem?

Maybe I should try it on another Mac... I only have one however.

Kind regards,
Samuel

On 1/10/2010, at 3:02 PM, Óscar Fuentes wrote:

> The following message is a courtesy copy of an article
> that has been posted to gmane.comp.compilers.llvm.devel as well.
> 
> Samuel Williams <space.ship.traveller <at> gmail.com> writes:
> 
> [snip]
> 
>> Could there be some additional option required for development files?
>> Currently, I have CMAKE_BUILD_TYPE=Release - maybe this doesn't
>> install headers?
> 
> `make install' installs everything, always, no options required.
leledumbo | 1 Oct 2010 04:19
Picon
Favicon
Gravatar

Re: Bls: Compiling LLVM 2.7 with MinGW GCC 4.5.0


> --enable-shared/DLL was not supported in 2.7. It has worked since Aug 2010.

Oh, OK. I'll try using svn version. Anyway, the compilation goes fine
(except for one gcc internal error: segmentation fault in the middle of the
process, which is gone when I re-invoke make) after I reinstall everything
using mingw-get. Looks like my mingw/msys installation got screwed up
somehow. Thanks for everything.
--

-- 
View this message in context: http://old.nabble.com/Compiling-LLVM-2.7-with-MinGW-GCC-4.5.0-tp29810752p29854181.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.
Óscar Fuentes | 1 Oct 2010 05:14
Picon

Re: CMake "sudo make install" & headers

Samuel Williams <space.ship.traveller <at> gmail.com> writes:

[snip]

> However, I am still having problems on Mac OS X with headers not being
> installed.
>
> Is the person who put together the CMake build files available to
> diagnose the problem?
>
> Maybe I should try it on another Mac... I only have one however.

I'm the person who put together the CMake build files, but sadly I have
less Macs than you :-/

That said, you are the first one who reports this problem, and there are
quite a few OSX users here. So I tend to suspect that something specific
of your machine triggers a bug in CMake.
Samuel Williams | 1 Oct 2010 05:56
Picon

Re: CMake "sudo make install" & headers

Dear Óscar,

Do many other Mac users use CMake from the command line?

Are you able to tell me the exact process that installs the headers, so I have somewhere to start to debug the issue?

Kind regards,
Samuel

On 1/10/2010, at 4:14 PM, Óscar Fuentes wrote:

> I'm the person who put together the CMake build files, but sadly I have
> less Macs than you :-/
> 
> That said, you are the first one who reports this problem, and there are
> quite a few OSX users here. So I tend to suspect that something specific
> of your machine triggers a bug in CMake.
Kulbhushan Pachauri | 1 Oct 2010 08:33

convert llvm ir to selection Dag

Hi,

 

Can anyone please tell me how can I scalarize or de-vectorize the llvm vector ir.  

In this (http://old.nabble.com/Re%3A-Thoughts-about-the-llvm-architecture---p29617203.html)  thread

I  found LegalizeTypes will do this while generating machine code from llvm ir..

 

How do I convert llvm ir to selection Dag. And scalarize the vector ir and again get back llvm ir…

 

 

Thanks & Regards,

Pachauri

 

 

_______________________________________________
LLVM Developers mailing list
LLVMdev <at> cs.uiuc.edu         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Bill Wendling | 1 Oct 2010 12:35
Picon
Favicon

Re: Illegal optimization in LLVM 2.8 during SelectionDAG? (Re: comparison pattern trouble - might be a bug in LLVM 2.8?)

On Sep 30, 2010, at 2:13 AM, Heikki Kultala wrote:

> Bill Wendling wrote:
>> On Sep 29, 2010, at 12:36 AM, Heikki Kultala wrote:
>> 
>>> On 29 Sep 2010, at 06:25, Heikki Kultala wrote:
>>> 
>>>> Our architecture has 1-bit boolean predicate registers.
>>>> 
>>>> I've defined comparison
>>>> 
>>>> def NErrb : InstTCE<(outs I1Regs:$op3), (ins I32Regs:$op1,I32Regs:$op2), "", [(set I1Regs:$op3,
(setne I32Regs:$op1, I32Regs:$op2))]>;
>>>> 
>>>> But then I end up having the following bug:
>>>> 
>>>> Code
>>>> 
>>>> %0 = zext i8 %data to i32
>>>> %1 = zext i16 %crc to i32
>>>> %2 = xor i32 %1, %0
>>>> %3 = and i32 %2, 1
>>>> %4 = icmp eq i32 %3, 0
>>>> 
>>>> which compares the lowest bits of the 2 variables
>>>> ends up being compiled as
>>>> 
>>>>      %reg16384<def> = LDWi <fi#-2>, 0; mem:LD4[FixedStack-2] I32Regs:%reg16384
>>>>      %reg16385<def> = LDWi <fi#-1>, 0; mem:LD4[FixedStack-1] I32Regs:%reg16385
>>>>      %reg16386<def> = COPY %reg16384; I32Regs:%reg16386,16384
>>>>      %reg16390<def> = NErrb %reg16384, %reg16385; I1Regs:%reg16390 I32Regs:%reg16384,16385
>>>> 
>>>> which just compares ALL BITS of the variables.
>>> I also have a pattern:
>>> 
>>> def XORrrb : InstTCE<(outs I1Regs:$op3), (ins I32Regs:$op1,I32Regs:$op2), "", [(set I1Regs:$op3,
(trunc (xor I32Regs:$op1, I32Regs:$op2)))]>;
>>> 
>>> Which can do the whole 3-operation code sequence correctly with one operation.
>>> 
>>> With LLVM 2.7 this correct operation is selected, with LLVM 2.8 the wrong operation(which compares all
bits) is chosen
>>> 
>>> So this looks like a bug in LLVM 2.8 isel?
>>> 
>> Hi Heikki,
>> 
>> We need a better example of what's going on. What's the original code? Also, I don't have access to your
back-end's code so it's hard to tell just from these snippets what's going on. For instance, it's not clear
whether it's the instruction selector that's at fault or if your .td files have a bug in them somewhere.
> 
> The original code is:

[snip]

> where the interesting lines are lines 12-13:
> 
>                 x16 = (e_u8)(((data) ^ ((e_u8)crc))&1);
>                 if (x16 == 1)
> 
> The code which goes into isel is:
> 
> bb.nph:
>   %0 = zext i8 %data to i32
>   %1 = zext i16 %crc to i32
>   %2 = xor i32 %1, %0
>   %3 = and i32 %2, 1
>   %4 = icmp eq i32 %3, 0
>   br i1 %4, label %bb.nph._crit_edge, label %5
> 
> inside selectiondag this becomes:
> 
> Legalized selection DAG:

[snip]

>         0x248d280: <multiple use>
>         0x248d980: <multiple use>
>       0x25bb7f0: i32 = xor 0x248d280, 0x248d980 [ORD=3] [ID=15]
> 
>     0x25bbbf0: i1 = truncate 0x25bb7f0 [ID=18]

This truncate is weird to me. If anything, it should be an "and" instruction. I have a feeling that your
back-end is telling instruction selection and the type legalizer that it's okay to replace the normal
"and" with this truncate call, which leads to your troubles later on.

I would suggest running this same code through another back-end to see if there's anything different going
on. For instance, both ARM and X86 keep the "and" around...

-bw

>     0x25bbff0: ch = BasicBlock< 0x2685718> [ID=9]
> 
>   0x25bc1f0: ch = brcond 0x25bc0f0, 0x25bbbf0, 0x25bbff0 [ID=20]
> 
> 
> 
> What is interesting is the 5 last lines..
> 
> There is xor, then trunc, taking only the lowest bit, and then brcond, 
> jumping on condition based on the lowest bit.
> 
> 
> 
> This routine then goes to SelectionDAG:Combine() which runs 
> DAGCombiner::visitBRCOND().
> 
> 
> 
> DAGCombiner::visitBRCOND() has code:
> 
>   SDValue N1 = N->getOperand(1);
>   SDValue N2 = N->getOperand(2);
> 
> ...
> 
>   SDNode *Trunc = 0;
>   if (N1.getOpcode() == ISD::TRUNCATE && N1.hasOneUse()) {
>     // Look past truncate.
>     Trunc = N1.getNode();
>     N1 = N1.getOperand(0);
>   }
> 
> which just drops the truncate away..
> then there is another optimization afterwards..
> 
>   // Transform br(xor(x, y)) -> br(x != y)
>   // Transform br(xor(xor(x,y), 1)) -> br (x == y)
>   if (N1.hasOneUse() && N1.getOpcode() == ISD::XOR) {
>     SDNode *TheXor = N1.getNode();
>     SDValue Op0 = TheXor->getOperand(0);
>     SDValue Op1 = TheXor->getOperand(1);
>     if (Op0.getOpcode() == Op1.getOpcode()) {
>       // Avoid missing important xor optimizations.
>       SDValue Tmp = visitXOR(TheXor);
>       if (Tmp.getNode() && Tmp.getNode() != TheXor) {
>         DEBUG(dbgs() << "\nReplacing.8 ";
>               TheXor->dump(&DAG);
>               dbgs() << "\nWith: ";
>               Tmp.getNode()->dump(&DAG);
>               dbgs() << '\n');
>         WorkListRemover DeadNodes(*this);
>         DAG.ReplaceAllUsesOfValueWith(N1, Tmp, &DeadNodes);
>         removeFromWorkList(TheXor);
>         DAG.DeleteNode(TheXor);
>         return DAG.getNode(ISD::BRCOND, N->getDebugLoc(),
>                            MVT::Other, Chain, Tmp, N2);
>       }
>     }
> 
>     if (Op0.getOpcode() != ISD::SETCC && Op1.getOpcode() != ISD::SETCC) {
>       bool Equal = false;
>       if (ConstantSDNode *RHSCI = dyn_cast<ConstantSDNode>(Op0))
>         if (RHSCI->getAPIntValue() == 1 && Op0.hasOneUse() &&
>             Op0.getOpcode() == ISD::XOR) {
>           TheXor = Op0.getNode();
>           Equal = true;
>         }
> 
>       SDValue NodeToReplace = Trunc ? SDValue(Trunc, 0) : N1;
> 
>       EVT SetCCVT = NodeToReplace.getValueType();
>       if (LegalTypes)
>         SetCCVT = TLI.getSetCCResultType(SetCCVT);
>       SDValue SetCC = DAG.getSetCC(TheXor->getDebugLoc(),
>                                    SetCCVT,
>                                    Op0, Op1,
>                                    Equal ? ISD::SETEQ : ISD::SETNE);
>       // Replace the uses of XOR with SETCC
>       WorkListRemover DeadNodes(*this);
>       DAG.ReplaceAllUsesOfValueWith(NodeToReplace, SetCC, &DeadNodes);
>       removeFromWorkList(NodeToReplace.getNode());
>       DAG.DeleteNode(NodeToReplace.getNode());
>       return DAG.getNode(ISD::BRCOND, N->getDebugLoc(),
>                          MVT::Other, Chain, SetCC, N2);
>     }
>   }
> }
> 
> 
> Which then optimizes the xor into setcc which looks ALL bits, not just 
> the lowest bit.
> 
> 
> 
> 
> Optimized legalized selection DAG:
> SelectionDAG has 21 nodes:
>   0x2536968: ch = EntryToken [ORD=1] [ID=0]
> 
>   0x2384a70: i32 = undef [ORD=1] [ID=2]
> 
>       0x2536968: <multiple use>
>       0x2384b70: i32 = FrameIndex<-1> [ORD=1] [ID=1]
> 
>       0x2384a70: <multiple use>
>     0x2384570: i32,ch = load 0x2536968, 0x2384b70, 
> 0x2384a70<LD4[FixedStack-1]> [ORD=1] [ID=10]
> 
>     0x2384470: ch = ValueType:i8 [ORD=1] [ID=4]
> 
>   0x2384970: i32 = AssertZext 0x2384570, 0x2384470 [ORD=1] [ID=12]
> 
>       0x2536968: <multiple use>
>       0x2384670: i32 = FrameIndex<-2> [ORD=2] [ID=3]
> 
>       0x2384a70: <multiple use>
>     0x2384c70: i32,ch = load 0x2536968, 0x2384670, 
> 0x2384a70<LD4[FixedStack-2]> [ORD=2] [ID=11]
> 
>     0x2384370: ch = ValueType:i16 [ORD=2] [ID=5]
> 
>   0x2384270: i32 = AssertZext 0x2384c70, 0x2384370 [ORD=2] [ID=13]
> 
>         0x2536968: <multiple use>
>         0x2384d70: i32 = Register %reg16384 [ID=6]
> 
>         0x2384270: <multiple use>
>       0x2384e70: ch = CopyToReg 0x2536968, 0x2384d70, 0x2384270 [ID=17]
> 
>         0x2536968: <multiple use>
>         0x2385070: i32 = Register %reg16385 [ID=7]
> 
>         0x2384970: <multiple use>
>       0x24b33f0: ch = CopyToReg 0x2536968, 0x2385070, 0x2384970 [ID=14]
> 
>         0x2536968: <multiple use>
>         0x24b35f0: i32 = Register %reg16386 [ID=8]
> 
>         0x2384270: <multiple use>
>       0x24b36f0: ch = CopyToReg 0x2536968, 0x24b35f0, 0x2384270 [ID=16]
> 
>     0x24b40f0: ch = TokenFactor 0x2384e70, 0x24b33f0, 0x24b36f0 [ID=19]
> 
>       0x2384270: <multiple use>
>       0x2384970: <multiple use>
>       0x24b38f0: ch = setne
> 
>     0x24b39f0: i1 = setcc 0x2384270, 0x2384970, 0x24b38f0
> 
>     0x24b3ff0: ch = BasicBlock< 0x25c5ff8> [ID=9]
> 
>   0x24b41f0: ch = brcond 0x24b40f0, 0x24b39f0, 0x24b3ff0 [ID=20]
> 
> 
> 
> 
> Here we have lost the information that we are only comparing the lowest 
> bits, as the trunc is gone, and the setcc is done with 32-bit 
> comparison, comparing all bits.
> 
> 
> 
> The way our backend is dynamically generated and loaded from a dynamic 
> library into custom executable which also links to llvm makes it a bit 
> hard to send a "easy to test" backend package for this situation.
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev <at> cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

Gmane