summaryrefslogtreecommitdiffstats
path: root/llvm/lib
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
commite51b57bee0f63a49e0a016256cda63535b88684c (patch)
tree1d3cebdc9c81d4283e8cfdb4a6e1cf202a1f75c3 /llvm/lib
parent73fd7e3bee1c070a3a42673ce59acdbaef2549f9 (diff)
downloadbcm5719-llvm-e51b57bee0f63a49e0a016256cda63535b88684c.tar.gz
bcm5719-llvm-e51b57bee0f63a49e0a016256cda63535b88684c.zip
ConstantFoldConstantExpression can theoretically return the original
expression; don't go into an infinite loop if it does. llvm-svn: 95591
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 5f730e03c6f..2fbd8dc098a 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/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
OpenPOWER on IntegriCloud