[llvm-commits] [dragonegg] r159413 - /dragonegg/trunk/src/ConstantConversion.cpp
Duncan Sands
baldrick at free.fr
Fri Jun 29 00:56:03 PDT 2012
Author: baldrick
Date: Fri Jun 29 02:56:03 2012
New Revision: 159413
URL: http://llvm.org/viewvc/llvm-project?rev=159413&view=rev
Log:
Fix 20021029-1.c from the GCC testsuite when using gcc-4.7 which generates a
MINUS_EXPR on two constant pointers (block addresses).
Modified:
dragonegg/trunk/src/ConstantConversion.cpp
Modified: dragonegg/trunk/src/ConstantConversion.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/ConstantConversion.cpp?rev=159413&r1=159412&r2=159413&view=diff
==============================================================================
--- dragonegg/trunk/src/ConstantConversion.cpp (original)
+++ dragonegg/trunk/src/ConstantConversion.cpp Fri Jun 29 02:56:03 2012
@@ -1350,6 +1350,11 @@
static Constant *ConvertMINUS_EXPR(tree exp, TargetFolder &Folder) {
Constant *LHS = getAsRegister(TREE_OPERAND(exp, 0), Folder);
Constant *RHS = getAsRegister(TREE_OPERAND(exp, 1), Folder);
+ if (LHS->getType()->getScalarType()->isPointerTy()) {
+ Type *PtrIntTy = getTargetData().getIntPtrType(Context);
+ LHS = Folder.CreatePtrToInt(LHS, PtrIntTy);
+ RHS = Folder.CreatePtrToInt(RHS, PtrIntTy);
+ }
return RepresentAsMemory(Folder.CreateSub(LHS, RHS), main_type(exp), Folder);
}
More information about the llvm-commits
mailing list