[LLVMdev] canonicalizing add in constant expressions
Chris Lattner
sabre at nondot.org
Fri May 2 09:28:30 PDT 2008
On Fri, 2 May 2008, Jay Foad wrote:
> I wrote some code that fell over when it encountered this ConstantExpr:
> i32 add (i32 24, i32 ptrtoint ([20 x %"struct.stlpmtx_std::string"]*
> @_ZN12BulletMLNode11name2stringE to i32)))
>
> because it expected the LHS of the add to be another ConstantExpr. (This is
> the first time that bit of code has fallen over, despite having compiled
> thousands of test cases and many megabytes of C and C++ source, so constant
> expressions like this must at least be pretty rare.)
>
> Is there a rule, or a convention, that the plain old constant should go on
> the RHS of an add like this? If so, I'll try to track down what created this
> constant expression. Otherwise I won't bother!
The compiler shouldn't crash, VMCore or ConstantFolding in this case
(which I assume is what is crashing) should do the canonicalization.
Please file a bug!
-Chris
--
http://nondot.org/sabre/
http://llvm.org/
More information about the llvm-dev
mailing list