@@ -208,17 +208,14 @@ struct CppEmitter {
208208 struct Scope {
209209 Scope (CppEmitter &emitter)
210210 : valueMapperScope(emitter.valueMapper),
211- blockMapperScope (emitter.blockMapper),
212- inductionVarMapperScope(emitter.loopInductionVarMapper),
213- emitter(emitter) {
211+ blockMapperScope (emitter.blockMapper), emitter(emitter) {
214212 emitter.labelInScopeCount .push (emitter.labelInScopeCount .top ());
215213 }
216214 ~Scope () { emitter.labelInScopeCount .pop (); }
217215
218216 private:
219217 llvm::ScopedHashTableScope<Value, std::string> valueMapperScope;
220218 llvm::ScopedHashTableScope<Block *, std::string> blockMapperScope;
221- llvm::ScopedHashTableScope<Value, std::string> inductionVarMapperScope;
222219 CppEmitter &emitter;
223220 };
224221
@@ -297,10 +294,6 @@ struct CppEmitter {
297294 // / Map from value to name of C++ variable that contain the name.
298295 ValueMapper valueMapper;
299296
300- // Map from value to name of C++ loop induction variable that contains the
301- // name.
302- ValueMapper loopInductionVarMapper;
303-
304297 // / Map from block to name of C++ label.
305298 BlockMapper blockMapper;
306299
@@ -1373,11 +1366,6 @@ void CppEmitter::cacheDeferredOpResult(Value value, StringRef str) {
13731366
13741367// / Return the existing or a new name for a Value.
13751368StringRef CppEmitter::getOrCreateName (Value val) {
1376- // Check whether value belongs to a loop induction variable
1377- if (loopInductionVarMapper.count (val)) {
1378- return *loopInductionVarMapper.begin (val);
1379- }
1380-
13811369 if (!valueMapper.count (val)) {
13821370 assert (!hasDeferredEmission (val.getDefiningOp ()) &&
13831371 " cacheDeferredOpResult should have been called on this value, "
@@ -1393,21 +1381,21 @@ StringRef CppEmitter::getOrCreateName(Value val) {
13931381StringRef CppEmitter::getOrCreateName (emitc::ForOp forOp) {
13941382 Value val = forOp.getInductionVar ();
13951383
1396- if (!loopInductionVarMapper .count (val)) {
1384+ if (!valueMapper .count (val)) {
13971385
13981386 int64_t identifier = loopNestingLevel++;
13991387
14001388 char range = ' z' - ' i' ;
14011389 if (identifier >= 0 && identifier <= range) {
1402- loopInductionVarMapper .insert (
1390+ valueMapper .insert (
14031391 val, formatv (" {0}_{1}" , (char )(identifier + ' i' ), ++valueCount));
14041392 } else {
14051393 // If running out of letters, continue with zX
1406- loopInductionVarMapper .insert (
1394+ valueMapper .insert (
14071395 val, formatv (" z{0}_{1}" , identifier - range - 1 , ++valueCount));
14081396 }
14091397 }
1410- return *loopInductionVarMapper .begin (val);
1398+ return *valueMapper .begin (val);
14111399}
14121400
14131401// / Return the existing or a new label for a Block.
0 commit comments