[LLVMdev] canonicalizing add in constant expressions

Jay Foad jay.foad at antixlabs.com
Fri May 2 06:30:32 PDT 2008


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!

Thanks,
Jay.




More information about the llvm-dev mailing list