diff options
-rw-r--r-- | lib/AsmParser/Lexer.l | 6 | ||||
-rw-r--r-- | lib/AsmParser/llvmAsmParser.y | 2 | ||||
-rw-r--r-- | test/Assembler/2007-07-30-AutoUpgradeZextSext.ll | 12 |
3 files changed, 20 insertions, 0 deletions
diff --git a/lib/AsmParser/Lexer.l b/lib/AsmParser/Lexer.l index 6b8bba5d68..19be3dc3b4 100644 --- a/lib/AsmParser/Lexer.l +++ b/lib/AsmParser/Lexer.l @@ -177,6 +177,8 @@ HexFPConstant 0x[0-9A-Fa-f]+ */ HexIntConstant [us]0x[0-9A-Fa-f]+ +/* WSNL - shorthand for newline followed by whitespace */ +WSNL [ \r\t\n]*$ %% {Comment} { /* Ignore comments for now */ } @@ -234,6 +236,10 @@ noreturn { return NORETURN; } noalias { return NOALIAS; } byval { return BYVAL; } nest { return NEST; } +sext{WSNL} { // For auto-upgrade only, drop in LLVM 3.0 + return SIGNEXT; } +zext{WSNL} { // For auto-upgrade only, drop in LLVM 3.0 + return ZEROEXT; } void { RET_TY(Type::VoidTy, VOID); } float { RET_TY(Type::FloatTy, FLOAT); } diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y index 0cc7a9831a..fd2713f307 100644 --- a/lib/AsmParser/llvmAsmParser.y +++ b/lib/AsmParser/llvmAsmParser.y @@ -1225,7 +1225,9 @@ OptCallingConv : /*empty*/ { $$ = CallingConv::C; } | }; ParamAttr : ZEROEXT { $$ = ParamAttr::ZExt; } + | ZEXT { $$ = ParamAttr::ZExt; } | SIGNEXT { $$ = ParamAttr::SExt; } + | SEXT { $$ = ParamAttr::SExt; } | INREG { $$ = ParamAttr::InReg; } | SRET { $$ = ParamAttr::StructRet; } | NOALIAS { $$ = ParamAttr::NoAlias; } diff --git a/test/Assembler/2007-07-30-AutoUpgradeZextSext.ll b/test/Assembler/2007-07-30-AutoUpgradeZextSext.ll new file mode 100644 index 0000000000..ea2db4414f --- /dev/null +++ b/test/Assembler/2007-07-30-AutoUpgradeZextSext.ll @@ -0,0 +1,12 @@ +; Test that upgrading zext/sext attributes to zeroext and signext +; works correctly. +; PR1553 +; RUN: llvm-as < %s > /dev/null + +define i32 @bar() { + %t = call i8 @foo( i8 10 sext ) zext + %x = zext i8 %t to i32 + ret i32 %x +} + +declare i8 @foo(i8 signext ) zeroext |