[prev in list] [next in list] [prev in thread] [next in thread]
List: llvm-bugs
Subject: [LLVMbugs] [Bug 2830] New: Cpp Backend doesn' t generate correct
From: bugzilla-daemon () cs ! uiuc ! edu
Date: 2008-09-26 9:19:03
Message-ID: bug-2830-206 () http ! llvm ! org/bugs/
[Download RAW message or body]
http://llvm.org/bugs/show_bug.cgi?id=2830
Summary: Cpp Backend doesn't generate correct code for Switch
instructions
Product: libraries
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Keywords: miscompilation
Severity: normal
Priority: P2
Component: Backend: C
AssignedTo: unassignedbugs@nondot.org
ReportedBy: bobby@sharedrealm.com
CC: llvmbugs@cs.uiuc.edu
Created an attachment (id=2039)
--> (http://llvm.org/bugs/attachment.cgi?id=2039)
bitcode containing switch insturction with 'i32 0' case statement.
I am trying to compile some bitcode to LLVM API calls using the Cpp backend:
llc -march=cpp --cppgen=program -o test.cpp test.bc
Compiling the generated C++ code fails with this error:
test.cpp: In function 'llvm::Module* makeLLVMModule()':
test.cpp:148: error: invalid conversion from 'llvm::Constant*' to
'llvm::ConstantInt*'
test.cpp:148: error: initializing argument 1 of 'void
llvm::SwitchInst::addCase(llvm::ConstantInt*, llvm::BasicBlock*)'
The problem is with this LLVM IR code:
switch i32 %1, label %bb5 [
i32 0, label %bb6
i32 1, label %bb2
]
The 'i32' constants '0' & '1' are defined with this c++ code:
// Constant Definitions
Constant* const_int32_7 = Constant::getNullValue(IntegerType::get(32));
ConstantInt* const_int32_8 = ConstantInt::get(APInt(32, "1", 1, 10));
and the switch instruction is created with this code:
SwitchInst* void_11 = SwitchInst::Create(int32_10, label_bb5, 3,
label_entry);
void_11->addCase(const_int32_7, label_bb6);
void_11->addCase(const_int32_8, label_bb2);
The 'addCase' method accepts a llvm::ConstantInt* as it's first argument, but
the 'i32 0' constant was created as just an 'llvm::Constant*'
P.S. Can someone add a "Backend: Cpp" Component to Bugzilla.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
LLVMbugs@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic