[llvm-commits] [dragonegg] r125276 - /dragonegg/trunk/llvm-convert.cpp
Duncan Sands
baldrick at free.fr
Thu Feb 10 02:21:31 PST 2011
Author: baldrick
Date: Thu Feb 10 04:21:31 2011
New Revision: 125276
URL: http://llvm.org/viewvc/llvm-project?rev=125276&view=rev
Log:
Fix the dragonegg build subsequent to changes Chris made to the target
folder interface.
Modified:
dragonegg/trunk/llvm-convert.cpp
Modified: dragonegg/trunk/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=125276&r1=125275&r2=125276&view=diff
==============================================================================
--- dragonegg/trunk/llvm-convert.cpp (original)
+++ dragonegg/trunk/llvm-convert.cpp Thu Feb 10 04:21:31 2011
@@ -126,6 +126,18 @@
return align ? align : 1;
}
+/// hasNUW - Return whether overflowing unsigned operations on this type result
+/// in undefined behaviour.
+static bool hasNUW(tree type) {
+ return TYPE_UNSIGNED(type) && !TYPE_OVERFLOW_WRAPS(type);
+}
+
+/// hasNSW - Return whether overflowing signed operations on this type result
+/// in undefined behaviour.
+static bool hasNSW(tree type) {
+ return !TYPE_UNSIGNED(type) && !TYPE_OVERFLOW_WRAPS(type);
+}
+
/// getSSAPlaceholder - A fake value associated with an SSA name when the name
/// is used before being defined (this can occur because basic blocks are not
/// output in dominator order). Replaced with the correct value when the SSA
@@ -8849,9 +8861,9 @@
Constant *IndexVal = Convert(Index);
tree LowerBound = array_ref_low_bound(exp);
if (!integer_zerop(LowerBound))
- IndexVal = TYPE_UNSIGNED(TREE_TYPE(Index)) ?
- TheFolder->CreateSub(IndexVal, Convert(LowerBound)) :
- TheFolder->CreateNSWSub(IndexVal, Convert(LowerBound));
+ IndexVal = TheFolder->CreateSub(IndexVal, Convert(LowerBound),
+ /*HasNUW*/hasNUW(TREE_TYPE(Index)),
+ /*HasNSW*/hasNSW(TREE_TYPE(Index)));
const Type *IntPtrTy = getTargetData().getIntPtrType(Context);
IndexVal = TheFolder->CreateIntCast(IndexVal, IntPtrTy,
More information about the llvm-commits
mailing list