I’m really a novice in experimenting with LLVM, so I might be doing something plain wrong here, but I can’t understand why this snippet
// File ticket.cpp
goes fine through the sequence
- clang++ -O0 -S -emit-llvm ticket.cpp (which generates ticket.s)
- llc -march=cpp ticket.s
So that I end up with a ticket.s.cpp that I can inspect to learn more about how to define structures in LLVM IR, while the following:
Fails during step 2) (llc -march=cpp ticket_stl.s) with a laconic:
LLVM ERROR: Invalid instruction
Everything works if I instead perform step 1) with -O1.
For what it’s worth, the online compiler at http://llvm.org/demo/index.cgi, targeting “LLVM C++ API code”, exhibits the same behavior (i.e. it fails at optimization level “None”).
Is this known/expected behavior?