aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-02-08 22:19:11 +0000
committerDan Gohman <gohman@apple.com>2010-02-08 22:19:11 +0000
commit54e72eca0c5d012546fcc6d1fdac7ee56c90686c (patch)
tree9763dc27aeb1ff532da1121a40ede42c0f48abb8 /lib/CodeGen
parent25ceb5f3171b24459e86adf5e18cebaaabe247d3 (diff)
ConstantFoldConstantExpression can theoretically return the original
expression; don't go into an infinite loop if it does. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95591 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/AsmPrinter/AsmPrinter.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 5f730e03c6..2fbd8dc098 100644
--- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -892,8 +892,10 @@ static const MCExpr *LowerConstant(const Constant *CV, AsmPrinter &AP) {
// If the code isn't optimized, there may be outstanding folding
// opportunities. Attempt to fold the expression using TargetData as a
// last resort before giving up.
- if (Constant *C = ConstantFoldConstantExpression(CE, AP.TM.getTargetData()))
- return LowerConstant(C, AP);
+ if (Constant *C =
+ ConstantFoldConstantExpression(CE, AP.TM.getTargetData()))
+ if (C != CE)
+ return LowerConstant(C, AP);
#ifndef NDEBUG
CE->dump();
#endif